Claus on Code

A data dudes random musings about code, bugs, products, life etc.


Setup the Membership and Roles features in ASP.NET

There are a lot of tutorials about how to use the standard membership and role features, and the custom controls that comes with them in ASP.NET.

There is however, a lack of information about how you setup and config your database and your web app, so you can use it with your standard MSSQL server.

First you need to run the ASP.NET SQL Server Registration Tool (Aspnet_regsql.exe), and point it to the database you are using. It is located here: C:\\%windir%\\Microsoft.NET\\Framework\\<versionNumber>\\aspnet_regsql.exe

Aspnet_regsql creates the tables and stored procedures, that your web app needs for you to use the standard controls.

Next you have to tell your web app where it can find the database with your membership information. You do that by adding these lines to the webconfig:

< connectionStrings>
<
remove name=LocalSqlServer/>
<
add name=LocalSqlServer connectionString=Server=servername;UID=your userid;PWD=your password;initial catalog=your catalog/>
…(add your other connection strings here)…
</connectionStrings>

You are now ready to start using the standard ASP.NET membership and role custom controls.
You can start here: http://www.asp.net/learn/videos/video-45.aspx



Leave a Reply

Your email address will not be published. Required fields are marked *