SlideShare ist ein Scribd-Unternehmen logo
1 von 6
Login 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:
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}TemplateLayouts.
So you will select Deploy as Server Farm solution after validation of the site URL.
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
The form will auto-generate some code where you:
Need to remove asp:Content ID="Content1" runat="server" from the
CustomLogin.aspx
Need to remove DynamicMasterPageFile="~masterurl/default.master" from the
@Page Register tag
Write simple HTML code for the Login Box user interface including username and
password textboxes anda Login Button like below:
Step 3:
Add the Microsoft.SharePoint.IdentityModel DLL reference from
.assemblyGAC_MSILMicrosoft.SharePoint.IdentityModel14.0.0.0__71e9bce111e9
429c Microsoft.SharePoint.IdentityModel.dll to access SPClaimsUtility
Include using Microsoft.SharePoint.IdentityModel; at CustomLogin.aspx.cs
Change Inheritance LayoutsPageBase to System.Web.UI.Page
Execute 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 .Microsoft
Sharedweb server extensions14TEMPLATELAYOUTSCustomLoginPageFBA
Step 5:
Change the custom page URL using following steps:
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 Steps
Download the complete source code from here
Check 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

Weitere ähnliche Inhalte

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Empfohlen

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Empfohlen (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

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

  • 1. Login 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:
  • 2. 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}TemplateLayouts. So you will select Deploy as Server Farm solution after validation of the site URL.
  • 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. The form will auto-generate some code where you: Need to remove asp:Content ID="Content1" runat="server" from the CustomLogin.aspx Need to remove DynamicMasterPageFile="~masterurl/default.master" from the @Page Register tag Write simple HTML code for the Login Box user interface including username and password textboxes anda Login Button like below:
  • 5. Step 3: Add the Microsoft.SharePoint.IdentityModel DLL reference from .assemblyGAC_MSILMicrosoft.SharePoint.IdentityModel14.0.0.0__71e9bce111e9 429c Microsoft.SharePoint.IdentityModel.dll to access SPClaimsUtility Include using Microsoft.SharePoint.IdentityModel; at CustomLogin.aspx.cs Change Inheritance LayoutsPageBase to System.Web.UI.Page Execute 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 .Microsoft Sharedweb server extensions14TEMPLATELAYOUTSCustomLoginPageFBA Step 5: Change the custom page URL using following steps:
  • 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 Steps Download the complete source code from here Check 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