The ASP.NET Membership provider makes it a peice of cake to add multiple user security to your web application. There are a few steps involved to setting it up that aren't exactly obvious. This article will explain how to creating the database tables and stored procedures in Microsoft SQL Server.
Open up a command prompt
Navigate to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\
(the final directory may vary depending on your installation version of the .NET framework)
The next step can be done in one of two ways. You will be running the AspNet_RegSql.exe utility.
To run in Wizzard mode simply run aspnet_regsql.exe and then follow the prompts to create your database
I prefer to automate this process. To do so, all you need to do is provide the parameters to create the tables. They are as follows:
-
-E = Authenticates using the Windows credentials of the currently logged-in user.
-
-S localhost = runs against the local installation of SQL Server.
-
-d database = specify the database name to run against
- -A all = the A option stands for "add", and the all parameter means install all features (Membership, Role management, Profile, Web Parts personalization, Web events)
So the final command should come out looking like:
aspnet_regsql.exe -E -S localhost -d database -A all
That's it. Refresh your database and you should see all the new tables and stored procedures that were automatically created.
To read the documentation on using the aspnet_regsql.exe utility visit: http://msdn2.microsoft.com/library/x28wfk74(en-us,vs.80).aspx
The next step is using these features. I'll cover that in our next article.