Steps to install ASP.NET Membership Services database

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.

Step 1:
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,

Step 1

Select the Next button from the above window, it will goto another page in the setup wizard.
Step 2:

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.

Step2

Then Press next button to continue.
Step 3:
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.
Step3

Press next button to proceed.
Step 4:

Select Next button and confirm your entered settings are correct.

Step 5:

After clicking the Next button in the above window will install a application services database. Click Finish button in this window.
Step5

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

Step 1:

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.
For Example,

<authentication mode=”forms”>

<forms loginUrl=”Login.aspx”

protection=”All”

name=”SqlMembershipProvider”

path=”/”

requireSSL=”false”

SlidingExpiration=”true”

defaultUrl=”Login.aspx”

cookieless=”UseCookies”

enableCrossAppRedirect=”false”

</authentication>

<authorization>

<deny user=”?” />

</authorization>

Step 2:
Then goto Menu bar, Project/Website—->ASP.NET Configuration,

After clicking this menu item one web page will appear like below,
aspnetwebapplicationadministration

Step 3:

When taking security tab , it provides some options like create user, manage user, disable roles etc.

securitytab

When clicking on the Create user link, we can add users.
Step 4:
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.

Conclusion

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.

Reference

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s