We have an application in which we have 3 UserTypes/Roles. Uers are reside under those any one of the UserTypes
When User login, depends on their usertype/role we should redirect them to their homepage.
User are going to Login inside the application via Form Based Authentication.
What steps we need to do to customize login page and make fulfil of our requirement?
Let us look at step by step of our requirement.
1> Under Layouts Folder, create a new folder give meaningful name like your application name, let us say for example “ApplicationSecurity”
2> The location of the original FBA Login.aspx page is here: “Local Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS” folder.
3> Copy Login.aspx under the newly created folder “ApplicationSecurity”. Now we have Login.aspx page is here:Local Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\ApplicationSecurity\Login.aspx
Next, open the web.config for your SharePoint application from the Virtual Directories, find the <forms loginUrl element, and change it from:
<authentication mode="Forms">
<forms loginUrl="/_layouts/login.aspx" />
</authentication>
<forms loginUrl="/_layouts/login.aspx" />
</authentication>
to:
<authentication mode="Forms">
<forms loginUrl="/_layouts/ApplicationSecurity/Login.aspx" />
</authentication>
<forms loginUrl="/_layouts/ApplicationSecurity/Login.aspx" />
</authentication>
Create a new Class Library project in Visual Studio and add references to Microsoft.SharePoint.dll, Microsoft.SharePoint.ApplicationPages.dll, and System.Web.
Rename Class1.cs to Login.cs.
using System;using System.Collections.Generic;using System.Text;using System.Web;using System.Web.Security;namespace SPFBASolutions.Login
{
public class Login : Microsoft.SharePoint.ApplicationPages.LoginPage {
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.login.LoggedIn += new EventHandler(OnLoggedIn);
}
// Fires after user has sucessfully logged in void OnLoggedIn(object sender, EventArgs e)
{
// Get the user MembershipUser Logginuser = Membership.GetUser(this.login.UserName);
if (Logginuser!= null)
{
//Custom Actions code
{
public class Login : Microsoft.SharePoint.ApplicationPages.LoginPage {
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.login.LoggedIn += new EventHandler(OnLoggedIn);
}
// Fires after user has sucessfully logged in void OnLoggedIn(object sender, EventArgs e)
{
// Get the user MembershipUser Logginuser = Membership.GetUser(this.login.UserName);
if (Logginuser!= null)
{
//Custom Actions code
}
}
}
}
}
}
}
Next, open the Custom Login.aspx page in Visual Studio which resides under this location Local Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\ApplicationSecurity\ and edit its Assembly and Page declarations to point the new code behind assembly.
<%@ Assembly Name=" SPFBASolutions.Login,Version=1.0.0.0, Culture=neutral, PublicKeyToken=a9ddedr5gacy9r0bn"%>
<%@ Page Language="C#" Inherits=" SPFBASolutions.Login.Login" MasterPageFile="~/_layouts/custom.master"%>
Last Step, place the compiled assembly into GAC.
Disha Shah
How do I sort Select People--Webpage Dialog for Group Column?
ReplyDeleteI used a "Person or Group" type column in a list. In the Additional Column
Settings, I selected the SharePoint Group radio button and chose aSharePoint
list (MyNames)
Now, when adding a new record to the list, I can choose the address book,
which brings up a the "Select People--Webpage Dialog". a list of users in my
list (MyNames). The dialog box is sorted by account name, which for us is
the User ID. I want to sort by Display Name, which is Last,First (much more
friendly).
I can't find a property the allows me to adjust this sort sequence.
any ideas?
Suman
How do I sort Select People--Webpage Dialog for Group Column?
ReplyDeleteI used a "Person or Group" type column in a list. In the Additional Column
Settings, I selected the SharePoint Group radio button and chose aSharePoint
list (MyNames)
Now, when adding a new record to the list, I can choose the address book,
which brings up a the "Select People--Webpage Dialog". a list of users in my
list (MyNames). The dialog box is sorted by account name, which for us is
the User ID. I want to sort by Display Name, which is Last,First (much more
friendly).
I can't find a property the allows me to adjust this sort sequence.
Anybody have any ideas?