log in page creation step by step
TRANSCRIPT
8/6/2019 Log in Page Creation Step by Step
http://slidepdf.com/reader/full/log-in-page-creation-step-by-step 1/11
Create a new web application from Central Administration.
Select Authentication as Claims Based Authentication
Check Enable FBA checkbox and specify Membership provider name and role manager name as
SqlMembers and SqlRoles.
Click on Ok to create the web application.
After successful creation of the web application create a site collection.
Navigate to C:\Windows\Microsoft.NET\Framework64\v2.0.50727 and run aspnew_regsql.exe tool
there.
Follow the screen shots below to create a new database named MYFBADB.
8/6/2019 Log in Page Creation Step by Step
http://slidepdf.com/reader/full/log-in-page-creation-step-by-step 2/11
8/6/2019 Log in Page Creation Step by Step
http://slidepdf.com/reader/full/log-in-page-creation-step-by-step 3/11
After successful creation of the database add the following information(highlighted in yellow) to the
web.config file of our FBA application
<membership
defaultProvider=i>
<providers>
<add
name=i
type=Microsoft.SharePoint.Administration.Claims.SPClaimsAuthMembershipProvider,
Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c />
<add
connectionStringName=SqlConn
applicationName=/
name=SqlMembers
type=System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
minRequiredPasswordLength=5
minRequiredNonalphanumericCharacters=0 />
</providers>
</membership>
8/6/2019 Log in Page Creation Step by Step
http://slidepdf.com/reader/full/log-in-page-creation-step-by-step 4/11
<roleManager
defaultProvider=c
enabled=true
cacheRolesInCookie=false>
<providers>
<add
name=c
type=Microsoft.SharePoint.Administration.Claims.SPClaimsAuthRoleProvider, Microsoft.SharePoint,
Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c />
<add
connectionStringName=SqlConn
applicationName=/
name=SqlRoles
type=System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a />
</providers>
</roleManager></SharePoint>
<connectionStrings>
<add
name=SqlConn
connectionString=server=crm2011;database=MYFBADB;Trusted_Connection=true />
</connectionStrings>
<system.web>
Next open the web.config of the Central admin site and add the same information added above
<roleManager enabled=true
defaultProvider=AspNetWindowsTokenRoleProvider>
<providers>
<add
connectionStringName=SqlConn
applicationName=/
name=SqlRoles
type=System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a/>
</providers>
</roleManager>
<providers>
<add
connectionStringName=SqlConn
applicationName=/
name=SqlMembers
type=System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0,
8/6/2019 Log in Page Creation Step by Step
http://slidepdf.com/reader/full/log-in-page-creation-step-by-step 5/11
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a />
</providers> </membership>
</SharePoint>
<connectionStrings>
<add
name=SqlConn
connectionString=server=crm2011;database= MYFBADB;Trusted_Connection=true />
</connectionStrings>
<system.web>
Lastly add the following configuration information in the web.config file of the
SecurityTokenServiceApplication (C:\Program Files\Common Files\Microsoft Shared\Web Server
Extensions\14\WebServices\SecurityToken)
</system.net>
<connectionStrings>
<add name=SqlConn
connectionString=server=crm2011;database= MYFBADB;Trusted_Connection=true />
</connectionStrings> <system.web>
<membership
defaultProvider=SqlMembers>
<providers>
<add
connectionStringName=SqlConn
applicationName=/
name=SqlMembers
type=System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3600.0,Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a />
</providers>
</membership>
<roleManager
enabled=true
defaultProvider=SqlRoles>
<providers>
<add
connectionStringName=SqlConn
applicationName=/
name=SqlRoles
type=System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a/>
</providers>
</roleManager>
</system.web>
8/6/2019 Log in Page Creation Step by Step
http://slidepdf.com/reader/full/log-in-page-creation-step-by-step 6/11
Creating Custom Login Page for Forms based Authentication in SharePoint 2010
Problem
Many applications need Claim Based Authentication instead of Classic Mode Authentication. The Form
Based Authentication (FBA) is one type of Claim Based Authentication. The default login page of FBA in
SharePoint 2010 is very simple which only provides a simple Login control with the user name, password
and remember me option. But many developers want to implement a customized login page for a better
looking experience or more options according to business requirements.
Solution
This article will demonstrate how to create a custom login page for a SharePoint site using Visual Studio
2010 and deploy it in a server farm. It will also include how to change the default login page URL from
the Central Administration Application Provider Settings
Step 1:
Create a new project type Empty SharePoint Project in Visual Studio 2010 as showed below:
8/6/2019 Log in Page Creation Step by Step
http://slidepdf.com/reader/full/log-in-page-creation-step-by-step 7/11
Provide a Project name and Press OK. You will be prompted with a Wizard to specify the SharePoint
site where you want to deploy the custom login page. You can validate the site URL to ensure that your
site is fine to deploy in this solution. Remember that you have to choose Deploy as Server Farm solution
instead of deploying as a sandboxed solution (default selected as below). Otherwise you will get an error
when you deploy the solution:
The deployment type "TemplateFile" of file "CustomLogin.aspx" in the Project Item "Layouts" is not
compatible with a Package in a Sandboxed Solution. Because Layout is root place to deploy in
SharePoint server farm which is mapped {SharePointRoot}\Template\Layouts.
So you will select Deploy as Server Farm solution after validation of the site URL.
8/6/2019 Log in Page Creation Step by Step
http://slidepdf.com/reader/full/log-in-page-creation-step-by-step 8/11
Then "Click to Finish and the project creation should be successful.
Step 2:
You have to add a new Application Page with a right-click on the project Solution Explorer ->
New item to create Custom Login page
8/6/2019 Log in Page Creation Step by Step
http://slidepdf.com/reader/full/log-in-page-creation-step-by-step 9/11
The form will auto-generate some code where you:
y Need to remove asp:Content ID="Content1" runat="server" from the CustomLogin.aspxy Need to remove DynamicMasterPageFile="~masterurl/default.master" from the @Page Register
tag
y Write simple HTML code for the Login Box user interface including username and password
textboxes anda Login Button like below:
8/6/2019 Log in Page Creation Step by Step
http://slidepdf.com/reader/full/log-in-page-creation-step-by-step 10/11
Step 3:
y Add the Microsoft.SharePoint.IdentityModel DLL reference from
.\assembly\GAC_MSIL\Microsoft.SharePoint.IdentityModel\14.0.0.0__71e9bce111e9429c
\Microsoft.SharePoint.IdentityModel.dll to access SPClaimsUtility
y Include using Microsoft.SharePoint.IdentityModel; at CustomLogin.aspx.cs
y Change Inheritance LayoutsPageBase to System.Web.UI.Page
y Execute the following code inside the Login button click event as below:
y bool status = SPClaimsUtility.AuthenticateFormsUser(
y Context.Request.UrlReferrer,y UserName.Text,
y Password.Text);
y if (!status)// if auth failed
y {
y lblError.Text = "Wrong Userid or Password";
y y }
y else //if success
y {
y Response.Redirect("http://fba.contosto.com"); //Use site url
y y }
Step 4:
Build the solution. Then Deploy the solution package which will create a folder inside .\Microsoft
Shared\web server extensions\14\TEMPLATE\LAYOUTS\CustomLoginPageFBA
8/6/2019 Log in Page Creation Step by Step
http://slidepdf.com/reader/full/log-in-page-creation-step-by-step 11/11
Step 5:
Change the custom page URL using following steps:
y Go to Central Administration.
y Select Site from Application Management.
y Click on Authentication Provider.
y Select Zone and go inside it to get the following Sign In Page URL Section.
y Change Custom Sign In Page URL.