[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