Search
Author
ASP.NET Tutorials
Author
Sheo Narayan
Advertisements


Winners

Win Prizes

Social Presence
Like us on Facebook

Silverlight Tutorials | Report a Bug in the Tutorial
asp:Login control
Login control provides a ready to use user interface that can be used as a Login interface in the web site.
 
Login control provides a ready to use user interface that can be used as a Login interface in the web site. Internally, When it is rendered on the page, it is implemented through <table></table> HTML tag.

Its properties like BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height etc. are implemented through style properites of <table, tr, td/> tag.

Following are some important properties that are very useful.
Properties of the Login Control
TitleText Indicates the text to be displayed in the heading of the control.
InstructionText Indicates the text that appears below the heading of the control.
UserNameLabelText Indicates the label text of the username text box.
PasswordLabelText Indicates the label text of the password text box.
FailureText Indicates the text that is displayed after failure of login attempt.
UserName Indicates the initial value in the username text box.
LoginButtonText Indicates the text of the Login button.
LoginButtonType Button/Link/Image. Indicates the type of login button.
DestinationPageUrl Indicates the URL to be sent after login attempt successful.
DisplayRememberMe true/false. Indicates whether to show Remember Me checkbox or not.
VisibleWhenLoggedIn true/false. If false, the control is not displayed on the page when the user is logged in.
CreateUserUrl Indicates the url of the create user page.
CreateUserText Indicates the text of the create user link.
PasswordRecoveryUrl Indicates the url of the password recovery page.
PasswordRecoveryText Indicates the text of the password recovery link.
Style of the Login Control
CheckBoxStyle Indicates the style property of the Remember Me checkbox.
FailureStyle Indicates the style property of the failure text.
TitleTextStyle Indicates the style property of the title text.
LoginButtonStyle Indicates the style property of the Login button.
TextBoxStyle Indicates the style property of the TextBox.
LabelStyle Indicates the style property of the labels of text box.
HyperLinkStyle Indicates the style property of the hyperlink in the control.
InstructionTextStyle Indicates the style property of the Instruction text that appears below the heading of the control.
Events of the Login Control
LoggingIn Fires before user is going to authenticate.
LoggedIn Fires after user is authenticated.
LoginError Fires after failure of login attempt.
Authenticate Fires to authenticate the user. This is the function where you need to write your own code to validate the user.
DEMO : Login Show Source Code
Log In
 
 
Register User
Forget password?
For working example, Please visit or Download.
                    
// Login Control ////////////////////////////          
<asp:Login ID="Login1" runat="server" BackColor="#F7F6F3" BorderColor="#E6E2D8" BorderPadding="4"
    BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em"
    ForeColor="#333333" OnAuthenticate="Login1_Authenticate" OnLoginError="Login1_LoginError">
    <TitleTextStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="0.9em" ForeColor="White" />
    <InstructionTextStyle Font-Italic="True" ForeColor="Black" />
    <TextBoxStyle Font-Size="0.8em" />
    <LoginButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px"
        Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284775" />
</asp:Login>