Online Shopping System (Task010)-Use of logon controls (basic configuration of logon controls)

Source: Internet
Author: User

1. Configure the aspnetdb Database

Use the logon control. To use membership, you must first support ASP. NET-configured database aspnetdb. Configure the database as follows:

1. Create Database NetShopServices

2. Go to the C: \ WINDOWS \ Microsoft. NET \ Framework \ v2.0.xxxxx(vs2010's directory is v4.0.xxxx). find aspnet_regsql.exe and double-click it to run it. An interface is displayed.

2. Go directly to the next step. On the second page, choose whether to add or remove the table structure. Of course, choose add to continue the next step.

3. Enter the Server IP address and authentication information in this interface. After entering this information, add the table structure to the NetShopServices database.

 

Note: If the default value is selected, a new database named aspnetdb is created and the table structure is added to the database. The database structure is added in the next step.

2. perform the following configuration in the Web. Config file:

1. Add a connection string

[Html] <add name = "NetShopMembershipConnString" connectionString = "server =. \ sqlexpress; database = NetShopServices; integrated security = SSPI;" providerName = "System. Data. SqlClient"/>
<Add name = "NetShopMembershipConnString" connectionString = "server =. \ sqlexpress; database = NetShopServices; integrated security = SSPI;" providerName = "System. Data. SqlClient"/>

 

2. Configure membership

[Html] <system. web>
<Membership defaultProvider = "SQLMembershipProvider1">
<Providers>
<Add name = "SQLMembershipProvider1"
Type = "System. Web. Security. SqlMembershipProvider"
ConnectionStringName = "NetShopMembershipConnString"
ApplicationName = "WestGarden"
MinRequiredPasswordLength = "1"
MinRequiredNonalphanumericCharacters = "0"
PasswordFormat = "Clear"/>
</Providers>
</Membership>
<System. web>
<System. web>
<Membership defaultProvider = "SQLMembershipProvider1">
<Providers>
<Add name = "SQLMembershipProvider1"
Type = "System. Web. Security. SqlMembershipProvider"
ConnectionStringName = "NetShopMembershipConnString"
ApplicationName = "WestGarden"
MinRequiredPasswordLength = "1"
MinRequiredNonalphanumericCharacters = "0"
PasswordFormat = "Clear"/>
</Providers>
</Membership>
<System. web>
 

 

3. Add NewUser. aspx and select master MasterPage. master.

4. Add the logon control CreateUserWizard and drag it directly. The default setting is as follows:

[Html] <asp: Content ID = "cntPage" ContentPlaceHolderID = "cphPage" Runat = "Server">
<Asp: CreateUserWizard ID = "CreateUserWizard" runat = "server">
<WizardSteps>
<Asp: CreateUserWizardStep runat = "server">
</Asp: CreateUserWizardStep>
<Asp: CompleteWizardStep runat = "server">
</Asp: CompleteWizardStep>
</WizardSteps>
</Asp: CreateUserWizard>
</Asp: Content>
<Asp: Content ID = "cntPage" ContentPlaceHolderID = "cphPage" Runat = "Server">
<Asp: CreateUserWizard ID = "CreateUserWizard" runat = "server">
<WizardSteps>
<Asp: CreateUserWizardStep runat = "server">
</Asp: CreateUserWizardStep>
<Asp: CompleteWizardStep runat = "server">
</Asp: CompleteWizardStep>
</WizardSteps>
</Asp: CreateUserWizard>
</Asp: Content>
 

 

5. Modify the page title

Title = "User Registration"

6. You can run, register, and view the results.

[Technical points]

1. The running of the CreateUserWizard control requires the support of the membership class. the settings of the membership class are in the Web. config file.

2. minRequiredPasswordLength = "1", minRequiredNonalphanumericCharacters = "0"

The minimum password length is 1, and the number of special characters such as @ and # Must be at least 0, that is, they can be none.

3. The passwordFormat attribute of SqlMembershipProvider. is set to the password format. It is usually set to Hashed, and is set to Clear for viewing convenience.

4. After registration, you can view the registration information in the database:

UserName is in the aspnet_Users table;

Password, Email, security prompt PasswordQuestion, and security answer PasswordAnswer are all in the aspnet_Membership table.

 

 

Author: yousuosi

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.