Login controls are in-built controls which provides a user interface in ASP.NET for managing the verification of users for a website. The verification is done according to username and password.
Following are the controls in login control:-
- ChangePassword control
- CreateUserWizard control
- Login control
- LoginView control
- LoginStatus control
- LoginName control
- PasswordRecovery control
1. ChangePassword control-- ChangePassword control allows the user to change the password which he is using to login the website.
Syntax of changing the password in asp.net is:
<asp:ChangePassword id="ChangePassword" newpasswordregularexpressionerrormessage="Error: Password must be 6 character long" runat="server" OnChangingPassword="ChangingPassword" OnChangedPassword="ChangedPassword" OnCancelButtonClick="CancelClick"></asp:ChangePassword>
2. CreateUserWizard control-- CreateUserWizard control allows a new user to register on the website by providing a interface.
Syntax of CreateUserWizard control is:
<asp:CreateUserWizard ID="CreateUserWizard1" Runat="server">
<WizardSteps>
<asp:CreateUserWizardStep runat="server">
</asp:CreateUserWizardStep>
<asp:CompleteWizardStep runat="server">
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
3. Login control-- Login control is an interface for user verification. It consist of textbox, label, buttons etc.
Syntax of Login control is:
<form id="form1" runat="server">
<div>
<asp:Login ID="Login1" runat="server" BackColor="#F7F7DE" BorderColor="#CCCC99"BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="10pt">
<TitleTextStyle BackColor="#6B696B" Font-Bold="True" ForeColor="#FFFFFF" />
</asp:Login>
</div>
</form>
4. LoginView control-- LoginView control is used to hide or display the information, according to the user's status.
Syntax of LoginView control is:
<asp:LoginView ID="loginvew" runat="server">
<AnonymousTemplate>
You are not Logged in.
</AnonymousTemplate>
<LoggedInTemplate>
You are Logged in.<asp:LoginStatus ID="LoginStatus2" runat="server" />
</LoggedInTemplate>
</asp:LoginView>
5. LoginStatus control-- LoginStatus control shows the status to the user. If the user is not logged in then a login link will be shown, if it is logged in then a logout link will be shown.
Syntax of LoginStatus control is:
<asp:LoginView ID="ctlRightNavbar" runat="server">
<AnonymousTemplate><a href="/login.aspx" class="navbar">
User Login</a></AnonymousTemplate>
<LoggedInTemplate>
<a href="/logout.aspx" class="navbar">
Logout <asp:LoginName ID="ctlUserName" Runat="server" /></a>
</LoggedInTemplate>
</asp:LoginView>
6. LoginName control-- The LoginName control is used to display the full name of the currently logged in user instead of user name.
Syntax of LoginName control is:
<asp:loginview id="HeadLoginView" runat="server" enableviewstate="false">
<AnonymousTemplate>
[ <a id="HeadLoginStatus" runat="server" href="login">Log In</a> ]
</AnonymousTemplate>
<LoggedInTemplate>
Welcome <span class="bold">
<asp:LoginName ID="HeadLoginName" runat="server" />
</span>! [
<asp:LoginStatus ID="HeadLoginStatus" runat="server"
LogoutAction="Redirect" LogoutPageUrl="~/home"
LogoutText="Log Out" />
]
</LoggedInTemplate>
</asp:loginview>
7. PasswordRecovery control-- The PasswordRecovery control is used to retrieve the forgot password through e-mail.
Syntax of PasswordRecovery control is:
<asp:PasswordRecovery ID="PasswordRecovery1" Runat="server">
</asp:PasswordRecovery>
0 Comment(s)