Login Web Server Control
In an asp.net application, we can create a user login page by using
Login web server control. This Login control displays a user interface for
user authentication. Login control renders two TextBoxes to input username and
password. It also displays a CheckBox that allows users to indicate whether
they want the server to store their identity for the next visit. It allows
users to be automatically authenticated for the next visit.
The Login control has many useful built-in properties to customize it. We can change the default look and feel of the login page by using the Login control's BackColor, BorderColor, BorderWidth, BorderStyle, CheckBoxStyle, CreateUserIconUrl, CreateUserText, CreateUserUrl, CssClass, Font, ForeColor, FailureTextStyle, Height, HelpPageIconUrl, LayoutTemplate, TextBoxStyle, TitleTextStyle, LabelStyle, InstructionTextStyle, HyperLinkStyle, LoginButtonStyle, ValidatorTextStyle, BorderPadding, and many more properties. The Login control is fully customizable through templates and style settings.
This Login control is a composite control that renders all common user interface elements needed to authenticate a user in an asp.net application (website).
Login control's CreateUserText property allows us to set the text of a link to a registration page for new users. CreateUserUrl property set an URL for the new user registration page. DestinationPageUrl set an URL of the page displayed to the user when a login is successful.
DisplayRememberMe allows us to show or hide Remember Me checkbox from a login page. FailureText property allows us to set the text displayed when a login attempt fails. HelpPageUrl property set an URL for the login help page. InstructionText property set login instruction text for the user.
We also can change the default text of login control's elements by properties settings such as title text, remember me text, password label text, etc.
The following asp.net example code demonstrates to us how can we create a user login page using Login server control in an asp.net application.
The Login control has many useful built-in properties to customize it. We can change the default look and feel of the login page by using the Login control's BackColor, BorderColor, BorderWidth, BorderStyle, CheckBoxStyle, CreateUserIconUrl, CreateUserText, CreateUserUrl, CssClass, Font, ForeColor, FailureTextStyle, Height, HelpPageIconUrl, LayoutTemplate, TextBoxStyle, TitleTextStyle, LabelStyle, InstructionTextStyle, HyperLinkStyle, LoginButtonStyle, ValidatorTextStyle, BorderPadding, and many more properties. The Login control is fully customizable through templates and style settings.
This Login control is a composite control that renders all common user interface elements needed to authenticate a user in an asp.net application (website).
Login control's CreateUserText property allows us to set the text of a link to a registration page for new users. CreateUserUrl property set an URL for the new user registration page. DestinationPageUrl set an URL of the page displayed to the user when a login is successful.
DisplayRememberMe allows us to show or hide Remember Me checkbox from a login page. FailureText property allows us to set the text displayed when a login attempt fails. HelpPageUrl property set an URL for the login help page. InstructionText property set login instruction text for the user.
We also can change the default text of login control's elements by properties settings such as title text, remember me text, password label text, etc.
The following asp.net example code demonstrates to us how can we create a user login page using Login server control in an asp.net application.
Login.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Login control Example: how to create Login page in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Login ID="Login1" runat="server"></asp:Login>
</div>
</form>
</body>
</html>
Default.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Using LoginStatus and LoginName Control</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>Home page</h1>
<asp:LoginStatus ID="LoginStatus1" runat="server" />
<br /><br />
<asp:LoginName ID="LoginName1" runat="server" FormatString="{0} logged in." Font-Size="Larger" ForeColor="Crimson" />
</div>
</form>
</body>
</html>

