Seven user management controls for ASP. NET controls

Source: Internet
Author: User

Seven controls related to user management in ASP. NET controls:
1. Login control: Implement User Login input as user name and password)
2. LoginView control: implements different views for anonymous users and logged-on users. You can design different combinations of controls that users can see in the two states.
3. PasswordRecovery control: used for detailed use after password recovery)
4. LoginStatus control: used to display the Login/Logout style through anonymous/Login user status.
5. LoginName control: indicates the user name upon logon.
6. CreateUserWizard control: defines the form information to be filled in during user registration and completes user registration directly.
7. ChangePassword control: completes Password Change

Now we can use the Login, LoginView, LoginStatus, LoginName, and CreateUserWizard controls in the above ASP. NET control to implement simple Web applications with the Login/registration function.

First, we must first go to the web. config to complete the configuration of the user database, the premise is that the reader has used aspnet_regsql to register the database application service, if you do not understand, participate in the ScottGu article <processing ing ASP. NET 2.0 Application Services to use SQL Server 2000 or SQL Server 2005>. Although it is in English, it is illustrated in the figure, which is simple and clear.

Then, modify the web. config file as follows:
1. Add a database connection string

 
 
  1. <connectionStrings> 
  2. <remove name="LocalSqlServer"/> 
  3. <add name="LocalSqlServer" connectionString="Data Source=localhost;
    Initial Catalog=RickTsueiDB;Integrated Security=True" providerName=
    "System.Data.SqlClient"/> 
  4. </connectionStrings> 
  5.  

2. modify the Form Verification Method to form authentication and set Membership settings. The DefaultUrl and LoginUrl in Forms settings are the URL addresses of our homepage and logon page respectively, after entering the information, log on to the related controls and find these pages.

 
 
  1. <authentication mode="Forms"> 
  2. <forms defaultUrl="~/Default.aspx" loginUrl="~/User/SignIn.aspx"/> 
  3. </authentication> 
  4. <membership defaultProvider="CustomizedProvider"> 
  5. <providers> 
  6. <add name="CustomizedProvider" type="System.Web.Security.
    SqlMembershipProvider" connectionStringName="localSqlServer" 
    applicationName="ScottsProject" minRequiredPasswordLength="5" 
    minRequiredNonalphanumericCharacters="0"/> 
  7. </providers> 
  8. </membership> 

Next let's go to the topic. First, we need to have three pages and one control. The three pages are Default. aspx (home page), SignIn. aspx (registration page) and CreateUser. aspx user registration page); a control is LoginControl. ascx User Logon Status control ).

LoginControl. ascx Control

 
 
  1. <% @ ControlLanguage="Vb" AutoEventWireup="False" CodeBehind=
    "LoginUserControl. ascx. vb" Inherits="Com. RickTsuei. UIC. LoginUserControl"%> 
  2. <Asp: LoginView ID="LoginView1" Runat="Server"> 
  3. <AnonymousTemplate> 
  4. <Asp: LoginStatus ID="LoginStatus_Login" Runat="Server" LoginText=
    "Login" LogoutText="Exit" /> 
  5. & Nbsp; | & nbsp;<A Href="../User/CreateUser. aspx">Register</A> 
  6. </AnonymousTemplate> 
  7. <LoggedInTemplate> 
  8. <Asp: LoginName ID="LoginName1" Runat="Server" /> 
  9. & Nbsp; | & nbsp;
  10. <Asp: LoginStatus ID="LoginStatus_Logout" Runat="Server" LoginText=
    "Login" LogoutText="Exit" /> 
  11. </LoggedInTemplate> 
  12. </Asp: LoginView> 

The above are seven controls related to user management in ASP. NET controls.

  1. Analysis on PageBase and MasterPage of ASP. NET
  2. XML Web Service Method of ASP. NET
  3. Detailed description of ASP. NET environment deployment
  4. Implement ASP. NET globalization
  5. Solve the Problem of ASP. net ajax script errors

Related Article

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.