SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Último

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
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
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
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 

Destaque

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)
 

Destaque (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