Successfully reported this slideshow.
Login SharePoint 2010ProblemMany applications need Claim Based Authentication instead of Classic Mode Authentication.The F...
Provide a Project name and Press “OK”. You will be prompted with a Wizard to specify theSharePoint site where you want to ...
Then "Click to Finish” and the project creation should be successful.Step 2:You have to add a new Application Page with a ...
The form will auto-generate some code where you:Need to remove asp:Content ID="Content1" runat="server" from theCustomLogi...
Step 3:Add the Microsoft.SharePoint.IdentityModel DLL reference from.assemblyGAC_MSILMicrosoft.SharePoint.IdentityModel14....
Go to Central Administration.Select Site from Application Management.Click on Authentication Provider.Select Zone and go i...
Upcoming SlideShare
Loading in …5
×

การสร้างฟอร์มสำหรับการ Login ใน share point 2010 ที่เป็นแบบของเราเอง

408 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

การสร้างฟอร์มสำหรับการ Login ใน share point 2010 ที่เป็นแบบของเราเอง

  1. 1. Login SharePoint 2010ProblemMany applications need Claim Based Authentication instead of Classic Mode Authentication.The Form Based Authentication (FBA) is one type of Claim Based Authentication. The defaultlogin page of FBA in SharePoint 2010 is very simple which only provides a simple Logincontrol with the user name, password and remember me option. But many developers wantto implement a customized login page for a better looking experience or more optionsaccording to business requirements.SolutionThis article will demonstrate how to create a custom login page for a SharePoint site usingVisual Studio 2010 and deploy it in a server farm. It will also include how to change the defaultlogin page URL from the Central Administration Application Provider Settings.Step 1:Create a new project type “Empty SharePoint Project” in Visual Studio 2010 as showedbelow:
  2. 2. Provide a Project name and Press “OK”. You will be prompted with a Wizard to specify theSharePoint site where you want to deploy the custom login page. You can validate the siteURL to ensure that your site is fine to deploy in this solution. Remember that you have tochoose 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 isroot place to deploy in SharePoint server farm which is mapped{SharePointRoot}TemplateLayouts.So you will select Deploy as Server Farm solution after validation of the site URL.
  3. 3. 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
  4. 4. The form will auto-generate some code where you:Need to remove asp:Content ID="Content1" runat="server" from theCustomLogin.aspxNeed to remove DynamicMasterPageFile="~masterurl/default.master" from the@Page Register tagWrite simple HTML code for the Login Box user interface including username andpassword textboxes anda Login Button like below:
  5. 5. Step 3:Add the Microsoft.SharePoint.IdentityModel DLL reference from.assemblyGAC_MSILMicrosoft.SharePoint.IdentityModel14.0.0.0__71e9bce111e9429c Microsoft.SharePoint.IdentityModel.dll to access SPClaimsUtilityInclude using Microsoft.SharePoint.IdentityModel; at CustomLogin.aspx.csChange Inheritance LayoutsPageBase to System.Web.UI.PageExecute the following code inside the Login button click event as below:bool status = SPClaimsUtility.AuthenticateFormsUser(Context.Request.UrlReferrer,UserName.Text,Password.Text);if (!status)// if auth failed{lblError.Text = "Wrong Userid or Password";}else //if success{Response.Redirect("http://fba.contosto.com"); //Use site url}Step 4:Build the solution. Then Deploy the solution package which will create a folder inside .MicrosoftSharedweb server extensions14TEMPLATELAYOUTSCustomLoginPageFBAStep 5:Change the custom page URL using following steps:
  6. 6. Go to Central Administration.Select Site from Application Management.Click on Authentication Provider.Select Zone and go inside it to get the following Sign In Page URL Section.Change Custom Sign In Page URL.Next StepsDownload the complete source code from hereCheck for a future article on how to register a new user for FBA authentication.Return to MSSharepointTips to read about other topics and ideas.Check out MSSQLTips.com for great information about Microsoft SQL Server

×