Initial Configuration of ASP. NET Website management tool

Source: Internet
Author: User

ASP. net website management tool is ASP. web operations provided by vs since net2.0. config GUI. compared with editing the Web directly. config is more convenient. however, the following problems may occur during configuration initialization.

Refer to several blogs and my own experiments to summarize something to write.

1. Open ASP. NET Website management tool

There are two ways to open this tool.

(1) click menu> Project> ASP. NET configuration. As shown in

(2) open it in Solution Explorer, as shown in

Open ASP. NET Website management tool:

 

2. There is no difficulty in installing sqlexpress

When installing vs, if sqlexpress is not installed, click the Security tab. After a long wait, you can see the following prompt:

The database cannot be found. This is not the case if sqlexpress is installed.

Why?

If sqlexpresss is installed, the system automatically creates and assembles a database in the app_data folder if no database is found when you use the management tool. Use the default connection string to establish a connection to the database.

If the database is not installed, it will not be created, and no other databases are configured. Of course, the SQL Server database cannot be found...

3. website database Initialization Configuration

(1) initialize the database location

I did not install sqlexpress when installing vs. Instead, I installed sqlserver2008separately. The database configuration encountered some trouble.

The default database link string of the ASP. NET Website is:

Data Source =. \ sqlexpress; Integrated Security = sspi; attachdbfilename = | datadirectory | aspnetdb. MDF; user instance = true

. In the IIS manager, you can see:

Sqlexpress is used. I did not install it. The qualification string is invalid and needs to be manually installed on the web. config. (Note: after VS is installed, the string is in c: \ windows \ Microsoft. net \ framework \ v2.0.50727 \ configmachine. config is inherited by all websites by default .)

Open the webconfig file and set the connection string as follows:

<Connectionstrings>
<Clear/>
<Add name = "connectionstring" connectionstring = "Data Source = ZYQ-PC \ sql2008; initial catalog = testdb; user id = sa; Password = ********; "/>
</Connectionstrings>

I am a testdb database under sql2008 as a website database.

(2) initialize the database content

In the path c: \ windows \ Microsoft. under Net \ framework \ v2.0.50727, find aspnet_regsql.exe and double-click ASP. in the netsqlserver Installation Wizard, initialize the database you just set as prompted. this tool adds tables and stored procedures to the database, as shown in:

If you are not addicted to using aspnet_regsql.exe, you can find c: \ windows \ Microsoft. install Several SQL files in the. NET \ framework \ v2.0.50727 folder manually (installcommon. SQL, installmembership. SQL, installpersistsqlstate. SQL, installpersonalization. SQL, installprofile. SQL, installroles. SQL, installsqlstate. SQL, installsqlstatetemplate. SQL, installwebeventsqlprovider. SQL ). The tool uses these SQL files to assemble databases.

 

4. Set membership and rolemanager to use the configuration tool

(The content here comes fromHttp://www.cnblogs.com/wqq4522/archive/2010/04/22/1717898.htmlBecause the set content is the same, I copied it to my webconfig)

Add a membership node under the system. Web node.

<Membership defaultprovider = "aspnetsqlmembershipprovider" userisonlinetimewindow = "15" hashalgorithmtype = "">

<Providers>

<Clear/>

<Add connectionstringname = "connectionstring" enablepasswordretrieval = "false" enablepasswordreset = "true" Success = "true" applicationname = "/" requiresuniqueemail = "false" passwordformat = "hashed" Success =" 5 "minrequiredpasswordlength =" 7 "minrequirednonalphanumericcharacters =" 1 "passwordattemptwindow =" 10 "passwordstrengthregularexpression =" "name =" aspnetsqlmembershipprovider "type =" system. web. security. sqlmembershipprovider, system. web, version = 2.0.0.0, culture = neutral, publickeytoken = b03f5f7f11d50a3a "/>

</Providers>

</Membership>

Attribute description:

Defaultprovider: ProvidesProgram. The default value is aspnetsqlmembershipprovider. If you have multiple providers, it is wise to specify a default value.

Userisonlinetimewindow: specify the number of minutes that the user is considered online after the date/timestamp of the last activity.

Hashalgorithmtype: Used to hash passwordsAlgorithmOr empty to use the default hash algorithm. Connectionstringname: connection name of the membership database.

Enablepasswordretrieval: indicates whether the current membership provider is configured to allow users to retrieve their passwords.

Enablepasswordreset: indicates whether the current membership provider is configured to allow users to reset their passwords.

Requiresquestionandanswer: indicates whether the default membership provider requires the user to answer the password prompt question during password reset and retrieval.

Applicationname: Application name.

Requiresuniqueemail: indicates whether the membership provider is configured to require each user name to have a unique email address.

Passwordformat: indicates the format of the password stored in the membership data storage area. Values include clear, encrypted, and hashed. Clear passwords are stored in plain text, which improves the performance of storing and retrieving passwords, but are less secure. When the security of data sources is threatened, such passwords are easily read. The encrypted password is encrypted during storage and can be decrypted during password comparison or retrieval. This type of password requires additional processing during storage and retrieval, but it is relatively secure and is not easy to obtain when the security of the data source is threatened. When the hashed password is stored in the database, it uses a one-way hash algorithm and a randomly generated salt value for hash processing. When a password is verified, the password is hash calculated using the salt value in the database for verification. The hash password cannot be retrieved.

Maxinvalidpasswordattempts: number of attempts to prompt questions and answers before an invalid or invalid password is allowed to lock a qualified user.

Minrequiredpasswordlength: minimum length required by the password.

Minrequirednonalphanumericcharacters: the minimum number of special characters that a valid Password must contain.

Passwordattemptwindow: the maximum number of minutes that a question answer attempt is prompted for an invalid or invalid password that is allowed before the user is locked. This is an additional measure to prevent unknown sources from repeatedly trying to guess the password of a Member-qualified user or the password prompts the answer to the question.

Passwordstrengthregularexpression: the regular expression used to calculate the password.

After configuring web. config for membership, configure its role management rolemanager, which is also under system. Web.

<Rolemanager enabled = "true" cacherolesincookie = "true">

<Providers>

<Clear/>

<Add connectionstringname = "connectionstring" applicationname = "/" name = "aspnetsqlroleprovider" type = "system. web. security. sqlroleprovider, system. web, version = 2.0.0.0, culture = neutral, publickeytoken = b03f5f7f11d50a3a "/>

</Providers>

</Rolemanager>

Attribute description:

Cacherolesincookie: indicates whether the current user's role has been cached in a cookie.

When the cacherolesincookie attribute is set to true in the configuration file, the role information of each user is stored in a cookie on the client. When role management checks whether a user belongs to a specific role, it checks the role cookie before calling the role provider to check the role list in the data source. The cookie is dynamically updated on the client to cache recently verified role names.

Web. config is configured almost.

5. After the settings are complete

Open the ASP. NET Website management tool again and click the Security tab. You can see the following interface without waiting:

You can perform many operations here. For the operation method, refer

Http://www.cnblogs.com/wqq4522/archive/2010/04/22/1717898.html

Http://www.cnblogs.com/ajiaojiao0303/archive/2010/11/25/1888178.html

I will not introduce it here.

 

Technorati label: ASP. NET Website management tool
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.