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

SUMMARY

This article describes how to configure the ASP.NET 2.0 Membership/Roles provider to use SQL 2005.

 

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 DBServerName -U DBLogin -P DBPassword -A all -d DBName

Currently, there is no management interface to manage the membership database besides using Visual Web Developer or creating your own application using the membership provider class.

 

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". Therefore, replace:
    <connectionStrings/>
    

     

    with
    <connectionStrings>
      <remove name="LocalSqlServer" />
      <add name="LocalSqlServer" connectionString="Data Source=DBServerName;Integrated Security=false;Initial Catalog=DBName;User ID=DBLogin;Password=DBPassword" providerName="System.Data.SqlClient" />
    </connectionStrings>
    
  4. Save and close the web.config.
  5. Go to Website menu, and run the ASP.NET Configuration tool. This will open the Web Site Administration tool.
  6. In the Web Site Administration tool, go to the Security tab.
  7. Click on "Select authentication type".
  8. Select "From the internet". Click the Done button.
  9. Create your admin roles and users.
  10. Then create access rules.
  11. Create a rule that applies to the "Anonymous users" with "Deny" permissions.
  12. Create another rule that applies to the admin role you created with "Allow" permissions.
  13. Your application is now ready to use the membership provider, and you can begin creating your login forms.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What is a Web Site Administration Tool?

Details The Web Site Administration Tool lets you view and manage the Web site configuration...

I get a configuration error when I execute my ASP.NET 2.0 web application.

DETAILSI get the following error when I try to execute my application. Parser Error Message:...

How to send email in ASP.NET 2.0

ASP.NET 2.0 has a built in class, System.Net.Mail, to send email. Although the legacy...

How to encrypt configuration sections of your web.config using a custom RsaProtectedConfigurationProvider

Details IMPORTANT NOTE: Web.config encryption only works with ASP.NET 2.0.  ...