Basic Steps for managing membership with. NET 2.0

Source: Internet
Author: User
Tags connectionstrings
. 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.

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.