Asp.net 2.0 logon series controls

Source: Internet
Author: User

Respect the author. Keep the words www.it55.com.

Log on to the control series to support visual operations. You only need to modify the corresponding attribute settings to meet the basic functions.CodeYou do not need to add any code to the layer. After a logon control is dragged into the page,. Net automatically adds a database to the database folder of the Project for data access to the control.

However, I personally think that ASP. NET 2.0 login controls, even including membership, role management, etc., in the actual development process are not flattering, or we need to write our own user login and roleProgram. So I won't talk much about it here. I will refer to a brief introduction from a netizen to give our. net2.0 learning end.

Together, many ASP. Net Logon controls provide a reliable and complete logon solution for ASP. NET web applications that do not require programming. By default, the logon control is integrated with ASP. NET membership to automate the user authentication process for the website. For information about ASP. NET membership, see membership introduction.

By default, the ASP. Net Logon control works on HTTP in plain text format. If you are very concerned about security, You Can Use https with SSL encryption.

This topic describes each control and provides links to its reference document.

Login Control

The login control displays the user interface used to perform user authentication. The login control contains a text box for user names and passwords and a check box that allows users to indicate whether the server needs to use ASP.. Net membership stores their identity and automatically performs authentication when they access the site next time.

The login control has attributes for custom display and custom messages, and links to other pages. On those pages, you can change the password or retrieve the forgot password. The login control can be used as an independent control on the home page, or you can use it on a dedicated logon page.

If you use the login control together with ASP. NET membership, you do not need to write the code to perform authentication. However, if you want to create your own authentication logic, you can process the authenticate event of the login control and add custom authentication code.

Loginview Control

You can use the loginview control to display different information to anonymous users and logon users. This control displays one of the following two templates: anonymoustemplate or loggedintemplate. In these templates, you can add tags and controls for anonymous users and authenticated users to display appropriate information respectively.

The loginview control also contains viewchanging and viewchanged events. You can write a handler for these events when a user logs on or changes the status.

Loginstatus Control

The loginstatus control displays a logon link for a user who does not pass authentication, and a Logout link for an authenticated user. The logon link takes the user to the logon page. The Logout link resets the identity of the current user to an anonymous user.

You can set the logintext and loginimageurl attributes to customize the appearance of the loginstatus control.

Loginname Control

If you have logged on using ASP. NET membership, the loginname control displays the user's login name. Alternatively, if the site uses integrated Windows authentication, the control displays the user's Windows account name.

Passwordrecovery Control

The passwordrecovery control allows you to retrieve the User Password Based on the email address used during Account creation. The passwordrecovery control sends an email containing the password to the user.

You can configure ASP. Net membership to store passwords with irreversible encryption. In this case, the passwordrecovery control generates a new password instead of sending the original password to the user.

You can also configure membership to include a security prompt that the user must answer in order to retrieve the password. In this case, the passwordrecovery control will ask this question and check the answer before retrieving the password.

The passwordrecovery control requires your application to forward emails to Simple Mail Transfer Protocol (SMTP) servers. You can customize the text and format of emails sent to users by setting the maildefinition attribute.

Note:
The password information in the email is sent in plaintext.
 

The following example demonstrates a passwordrecovery Control declared on the ASP. NET page. Its maildefinition attribute is set to customize email.

<Asp: passwordrecovery id = "passwordrecovery1" runat = "server"
Submitbuttontext = "get password" submitbuttontype = "Link">
<Maildefinition from = "administrator@Contoso.com"
Subject = "your new password"
Bodyfilename = "passwordmail.txt"/>
</ASP: passwordrecovery>

Createuserwizard Control

The createuserwizard control collects information provided by potential users. By default, the createuserwizard control adds new users to the ASP. NET membership system.

The createuserwizard control collects the following user information:

User Name

Password

Confirm Password

Email Address

Security Prompt

Security answer

This information is used to authenticate the user and retrieve the user password (if needed ).

Note:
The createuserwizard control inherits from the wizard control.
 

The following example demonstrates a typical ASP. net declaration of the createuserwizard control:

<Asp: createuserwizard id = "createuserwizard1" runat = "server"
Continuedestinationpageurl = "~ /Default. aspx ">
<Wizardsteps>
<Asp: createuserwizardstep runat = "server"
Title = "sign up for your new account">
</ASP: createuserwizardstep>
<Asp: completewizardstep runat = "server"
Title = "complete">
</ASP: completewizardstep>
</Wizardsteps>
</ASP: createuserwizard>

Changepassword Control

You can change the password of the changepassword control. You must first provide the original password, and then create and confirm the new password. If the original password is correct, the user password is changed to the new password. This control also supports sending emails about the new password. # P # paging title # e #

The changepassword control contains two templated views displayed to the user. The first template is changepasswordtemplate, which displays the user interface used to collect the data required to change the user password. The second template is successtemplate, which defines the user interface displayed after the user password is changed successfully.

The changepassword control is used by authenticated and unauthenticated users. If the user does not pass authentication, the control prompts the user to enter the login name. If the user has passed authentication, the control will fill the text box with the user's login name.

End

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.