How to configure the ASP.NET 2.0 Membership/Roles Provider to use SQL 2000 or SQL 2005?

The information in this article applies to:

  • ASP.NET 2.0
  • MS SQL 2000
  • MS SQL 2005
  • Membership/Roles Provider

    SUMMARY

    How to set up the new ASP.NET 2.0 Membership, Role Management, and Personalization services to use a regular hosted SQL Server 2005 or SQL 2000 instead of MicroSoft SQL Server Express.

    DETAILS

    The following steps create the full Application Services database schema on our SQL Server database.

    1. Open the command prompt on your local computer, and navigate to:
      C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
    2. Execute the command:
      aspnet_regsql.exe -S [DB Server Name] -U [DB login] -P [Password] -A all -d [Database name]

    Below is an example of how to configure Visual Web Developer to manage the membership database.

    1. Create a web application in Visual Web Developer or Visual Studio 2005.
    2. Open the web.config.
    3. The default membership provider uses a connection string called "LocalSqlServer".          

    Replace:

    <connectionStrings/>

    with

    <connectionStrings><remove name="LocalSqlServer" />
    	<add name="LocalSqlServer" connectionString="Data Source=<DB_Server>;Integrated Security=false;Initial 
    		Catalog=<DB_Name>;User ID=<DB_User>;Password=<DB_password>" providerName="System.Data.SqlClient" />
    </connectionStrings>
     Save and close the web.config. 
    1. Go to Website menu, and run the ASP.NET Configuration tool. This will open the Web Site Administration tool in a browser window.
    2. Next.. In the Web Site Administration browser, go to the Security tab.
    3. Click on "Select authentication type".
    4. Select "From the internet".  Then click the "Done" button.
    5. Create your admin roles and users.
    6. Then create access rules.
    7. Create a rule that applies to the "Anonymous users" with "Deny" permissions.
    8. Create another rule that applies to the admin role you created with "Allow" permissions.
    9. Your application is now ready to use the membership provider.
  • Copied for ease of access. Credit given to: http://support.re-invent.com/article.aspx?id=10353