// Articles. Tutorials. Utilities.
Home  |   Search  |   Login  
Categories Skip Navigation Links
New / All
Google / Android
Python / IronPython
SQL Server
Setting up the authentication (users and passwords) database in ASP.NET 2.0
By default SQLEXPRESS is used as the database that contains the membership information. Some thoughts in this regard.
Table of Contents

In Summary:


By default, the membership database is setup in the App_Data folder of your application; name of the database file is ASPNETDB.MDF. It is very likely that you want this set of tables to be in your regular SQL Server database for any number of reasons:

  • You want all the user information tables to be near your other (application-related) tables, so you can maintain some relationships between these tables.
  • You don’t want multiple databases: one for just the user data and another for application data
  • Your hosting company might not provide the ability to use SQLEXPRESS databases for security reasons

So, how would you set up the membership and roles related tables in your regular SQL Server databases?

Check out the following links for step-by-step instructions:

Scott Guthrie’s blog post on "Configuring ASP.NET 2.0 Application Services to use SQL Server 2000 or SQL Server 2005":


It also appears on MSDN (better formatting):


In Summary:

Use aspnet_regsql.exe from command line and follow the instructions.

Following commands should work (choose the appropriate .NET Framework directory)

cd C:\Windows\Microsoft.NET\Framework\v2.0.50727

-Using the above utility you can either install or remove the set of database objects (tables, views, stored procedures) used for membership, roles, etc. So, don’t worry about accidentally cluttering your db -- if you installed this by mistake, you can remove them as well.

After you successfuly run the above utility, you will see the following in your database:

  • 11 new tables with names prefixed with aspnet_
  • 9 new views with names prefixed with vw_aspnet_
  • Several new stored procedures prefixed with aspnet_

Now, how does your application know where are these membership related tables installed? Setup a connection string for "LocalSqlServer" (not the most intuitive name, but that’s what’s used by Microsoft).

<remove name="LocalSqlServer"/>

<add name="LocalSqlServer" providerName="System.Data.SqlClient" connectionString="Data Source=;Initial Catalog=;Persist Security Info=True;User ID=;Password=" />


Now you can use the Web Site Administration Tool to further setup the users, roles, etc.

Bookmark and Share This

More Articles With Similar Tags
You have added the extra controls to the CreateUserWizard to collect additional information from the user at the time of new account creation. This article discusses how to save that extra information to the database.
This article looks at adding a role to the user that has been newly created via the CreateUserWizard.
This article discusses the CreateUserWizard and looks at extending the default user interface provided by it.
This article discusses the difference between authentication and authorization. It also discusses how the data required to support each of these features is stored in the database in ASP.NET 2.0 sites.
About  Contact  Privacy Policy  Site Map