ASP.net's Login control (zhuan)

Source: Internet
Author: User

 

The name is ASP. Login. There are two common events in this control. OnAuthenticate is used to verify the logon password, and OnLoggedIn is used to manage logon events, such as Cookies and jump to pages.
The page layout is placed below<LayoutTemplate>,When logging on, you need to declare the button that you click. CommandName = "Login" is used to associate the button with the previous event.. In addition, in the OnAuthenticate Event Response, Argument is AuthenticateEventArgs. Set the e. Authenticated attribute of this variable to True to indicate that the user has entered the system. Otherwise, it is rejected.
In the webpage, this. User. Identity. IsAuthenticated is used to check the User's Login status.

Asp.net login control
1. event OnAuthenticate: check login name and password, if OK, set e. Authenticated to true
Protected void Login_User_Authenticate (object sender, AuthenticateEventArgs e)
{
Bool Authenticated = false;
String compoundName = ConvertUserName (this. Login_User.UserName );
Authenticated = AuthenticateUser (compoundName, this. Login_User.Password );
E. Authenticated = Authenticated;
}
2. event OnLoggedIn
Check if remember me on this computer. If it is, set cookies
3. <LayoutTemplate>
Customerize login control. Do whatever you like but use the specified user id and command name.
UserName
Any control that implements IEditableTextControl, including TextBox, or a custom or third-party control.
Required
Password
Any control that implements IEditableTextControl, including TextBox, or a custom or third-party control.
Required
RememberMe
CheckBox
Optional
FailureText
Any control that implements ITextControl.
Optional
Login
Any control that causes event bubbling.
Optional
4. In web. config
From the root directory
<Location path = "FolderName">
<System. web>
<Authorization>
<Deny users = "? "/>
</Authorization>
</System. web>
</Location>
From root <configure>-> System. Web
<Authentication mode = "Forms">
<Forms name = ". ASPXADBARGAINS" defaultUrl = & quotefault. aspx "loginUrl = "~ /Public/LoginUser. aspx ">
</Forms>
</Authentication>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.