Custom LogIn Page For SharePoint2010
For Form Based Authentication / Sql Server
First enable for web application from Central Admin.
then Enter your membership provider in "ASP.NET Membership provider name"
Select and give the url of the Login Page Remember the Login page must be an application page deployed in Mapped folder of your web application generally it is "~/_layouts/<PortlLoginPage>/Login.aspx"
you can use a standard asp.net based Login Page as
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustLoginOOB.aspx.cs" Inherits="FBAAddOns.Layouts.FBAAddOns.CustLoginOOB" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Custom Login Page</title>
<style type="text/css">
body{
margin: 0 auto;
text-align:center;
}
div.custbody
{
padding: 10px;
margin: 50px auto;
border: 1px solid #444;
width: 400px;
text-align: left;
background-color: #eee;
}
div.custbody div
{
font-family: Arial;
font-size: 12px;
}
.form_tb
{
width: 200px;
font-family: Arial;
font-size: 12px;
}
.form_btn
{
font-family: Arial;
font-size: 12px;
padding: 1px 6px;
}
div.messages
{
font-family: Arial;
font-size: 12px;
color: Red;
font-style: italic;
}
div.wbs
{
margin: 0 0 10px 0;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="custbody">
<asp:PlaceHolder runat="server" ID="phPart1" Visible="true">
<h3>Enter your credentials below to login.</h3>
<div>
Username:<br />
<asp:TextBox runat="server" ID="txtUsername" CssClass="form_tb"></asp:TextBox>
</div>
<div>
Password:<br />
<asp:TextBox runat="server" ID="txtPassword" CssClass="form_tb" TextMode="Password"></asp:TextBox>
</div>
<div>
<asp:Button runat="server" ID="btnSubmit" Text="Login" CssClass="form_btn" OnClick="btnSubmit_OnClick" />
</div>
</asp:PlaceHolder>
<div class="messages">
<asp:Literal runat="server" ID="litStatus"></asp:Literal>
</div>
</div>
</form>
</body>
</html>
In the code behind in the submit button click event
use the following code:
litStatus.Text = "";
if (string.IsNullOrEmpty(txtUsername.Text) || string.IsNullOrEmpty(txtPassword.Text))
{
litStatus.Text = "Please enter a username and password.";
return;
}
bool status = SPClaimsUtility.AuthenticateFormsUser(
Request.Url,
txtUsername.Text,
txtPassword.Text);
if (!status)// if auth failed
{
litStatus.Text = "Invalid username or password.";
return;
}
else // if success
{
Response.Redirect("/"); // Use site url
}
SPClaimsUtility.AuthenticateFormsUser will automatically call the Validate Method of the configured Membership Provider defined in the web.config of your web application so all the user Identities, Permissions and other user specific informations are handled by SharePoint.
When guests stay at the property, they a glance 파라오 카지노 도메인 at|try} how quiet the room is, how pleasant the staff is, and more. Casino & Hotel - Philadelphia accepts these cards and reserves the proper to briefly hold an amount prior to arrival. Cancellation and prepayment insurance policies range based on accommodations kind.
ReplyDelete