. NET 2.0 provides membership management. This article briefly introduces the basic steps for using membership management.
1. Use aspnet_regsql to create a database
Open Visual Studio 2005 command prompt, enter aspnet_regsql, create the aspnetdb database according to the wizard, and save the user information.
2. Select website \ ASP. NET configuration to manually configure the membership.
3. modify the configuration in the web. config file
<Connectionstrings>
<Add name = "sqlservices" connectionstring = "Data Source = (local); Integrated Security = sspi; initial catalog = aspnetdb;"/>
</Connectionstrings>
<System. Web>
<Membership defaultprovider = "sqlprovider" userisonlinetimewindow = "20">
<Providers>
<Add name = "sqlprovider" type = "system. web. security. sqlmembershipprovider "connectionstringname =" sqlservices "enablepasswordretrieval =" false "enablepasswordreset =" true "requiresquestionandanswer =" true "passwordformat =" hashed "applicationname ="/"/>
</Providers>
</Membership>
</System. Web>
4. Create the newuser. ASPX page and add the createuserwizard control to it.
<Asp: createuserwizard id = "createuserwizard1" runat = "server">
<Wizardsteps>
<Asp: createuserwizardstep runat = "server">
</ASP: createuserwizardstep>
<Asp: completewizardstep runat = "server">
</ASP: completewizardstep>
</Wizardsteps>
</ASP: createuserwizard>
5. Create the login. ASPX page, add the login control to the page, and set attributes of createusertext and createuserurl.
<Asp: Login ID = "login1" runat = "server" createusertext = "create new user" createuserurl = "~ /Newuser. aspx"
Destinationpageurl = "~ /Default. aspx ">
</ASP: Login>
6. Add the loginstatus and loginname controls on the default. aspx page.
<Asp: loginstatus id = "loginstatus1" runat = "server"/>
<Asp: loginname id = "loginname1" runat = "server"/>
7. Set login. aspx to the start page for testing.