IntroductionThe objective of this article is to configure ASP.NET Membership to store user information in an external SQL Server database. We will use SQLMembershipProvider for this task.ASP.NET MembershipASP.NET Membership enables us to validate and store user information. It creates all the necessary tables and stored procedures to store and manage user credentials. It provides an API that can be used to manage user's information programmatically. ASP.NET Membership provides two types of Membership providers:
To configure SQLMembershipProvider, first you need to configure your database. Open Visual Studio Command Prompt (All Programs -> Microsoft Visual Studio 2008 -> Visual Studio Tools -> Visual Studio 2008 Command Prompt)Type command : aspnet_regsql and press EnterThis will launch ASP.NET SQL Server Setup WizardClick NextLeave the default selection "Configure SQL Server for application services" and click Next again.Enter the server name, Select SQL Server authentication and enter user id and password as in the following figure. Select the database you want to configure. Here, I am using Employee database.Click NextClick Next and then Finish.Now, you can see the new tables created in the Employee database for storing user credentials. These table names start with "aspnet_". Similarly, you can also see new Stored Procedures created in the database with "aspnet_" prefix.Now, we have configured our Employee database. Our next task is to enable SQLMembershipProvider in a Web application. Follow these steps to do that:
type="System.Web.Security.SqlMembershipProvider" connectionStringName="ConString" /> </providers></membership>
Now, we are ready to use ASP.NET Membership to create a new user using CreateUserWizard control and authenticate users using Login control.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: