[ASP. NET 2.0 Security FAQs] how to set up an SQL Server or SQL express database to support membership, profiles, and role

Source: Internet
Author: User

[ASP. NET 2.0 Security FAQs] Directory

Original article link

Translation: 2005-12-10Jackei Lin

Membership, profiles, and role in ASP. NET 2.0 must store relevant information in the data source. The default providers for these features areSqlmembershipprovider,SqlprofileproviderAndSqlroleprovider.

If you do not configure a special provider, yourProgramThe above default provider will be used. When your program calls a default provider for the first time, ASP. NET will automaticallyApp_dataCreate an SQL express database in the directory to store the required information.

If you want to use a specific SQL server or SQL express database server, you must configure your program to provide the information required by the provider to call a specific database. In addition, you must configure the relevant database.

UseAspnet_regsql.exeTo create or configure a specific database. For example, execute the following command in the command line tool (CMD:

 
Aspnet_regsql-s (local)-e-a flat

-S assigns a specific database server. In this example, it is (local ).

-E connect to the relevant SQL Server server using Windows trusted connection.

-Added support for A-flat, M: membership, P: profiles, R: roles.

Execute aspnet_regsql /?, You can get a list of all related commands.

UseAspnet_regsqlThe configured aspnetdb (or other) database uses the database role to control the access to the library. you must run ASP. the account of the net program can access the aspnetdb database so that your program can use the relevant information in the database. for example, run the following statement in SQL query analyzer to enable the network service account to create relevant data:

 
-- Create an SQL Server login sp_grantlogin 'nt Authority \ Network service' for the network service account'
 
-- Allow the account to access the membership database use aspnetdb go sp_grantdbaccess 'nt Authority \ Network service', 'network Service'
 
-- Add the user to the data role use aspnetdb go sp_addrolemember 'aspnet _ membership_fullaccess', 'network Service'

Note: aspnet_regsql.exe is located in the c: \ windows \ Microsoft. NET \ framework \ v2.0.50727 directory. It can also be used to configure a database to store sessions.

Other Related Materials:
processing ing ASP. NET 2.0 application services to use SQL Server 2000 or SQL Server 2005 by Scott Guthrie
. NET 2.0 application service is configured to use SQL Server 2000 or SQL Server 2005

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.