SQL Membership provider is mainly using for storing and retrieving user credentials for an application. This will avoid lengthy codes for user authentication from applications. There are mainly two types of Membership providers are there, SQLMembershipProvider and ActiveDirectoryMembershipProvider. For adding users, Microsoft providing a setup wizard named ASP.NET SQL Server Setup Wizard. Here I am discussing about SQLMembershipProvider.
Run aspnet_regsql.exe located in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 on your machine. It will open a configuration wizard as below,
Select the Next button from the above window, it will goto another page in the setup wizard.
From the the second window select d database task you need to perform. On this window you can select Configure SQL Server for application services radio button or Remove application services information from an existing database.
Then Press next button to continue.
In the next window you should give the name of the Server, select the authentication type( Windows authentication or Sql server authentication), if it is sql server authentication means give the user credentials and finally give the name of the database.
Press next button to proceed.
Select Next button and confirm your entered settings are correct.
After clicking the Next button in the above window will install a application services database. Click Finish button in this window.
In the newly created database contains some tables like users, roles etc and some stored procedures for storing, retrieving and manipulating data.
Steps to add Users into the application
Take web.config file. Then set the connection string(Here Database name: ASPNETServices and also provide the credentials).
After that add authentication details such as mode,loginurl,protection etc and authorization details.
<deny user="?" />
Then goto Menu bar, Project/Website---->ASP.NET Configuration,
After clicking this menu item one web page will appear like below,
When taking security tab , it provides some options like create user, manage user, disable roles etc.
When clicking on the Create user link, we can add users.
Fill the fields and click Create user button. After that one message will appear it indicates that your account created successfully. Using the credentials we can retrieve(login) the application. Using this Asp.Net Webapplication administration, we can create users, manage users, manage roles etc.
SQL Membership provider is useful utility for user management. For modifying user setting we can use the Membership class, that contains some methods such as ChangePassword(), CreateUser(), DeleteUser() etc for various user management purposes.