Learn Membership Services Part 1: Installing ASP.NET Membership Services Database in SQL Server 2008

Introduction

We create a website or web application that has a login page, user panel, admin panel etcetera. We do a lot of code, queries to register a user and to validate a user for login in his/her panel. To reduce code or almost remove code for login/register from the application/website, the membership feature comes in ASP.NET. The membership feature provides an abstraction for the underlying data store used to maintain user credentials such as user names and passwords, and it provides an API that allows you to easily validate user credentials and manage the user database. ASP.NET supports SQL Server and Active Directory providers, and we can also create our own providers for custom stores.

This article explains:

  1. How to create database using SQL Server Management Studio
  2. How to install an ASP.NET Membership Services Database in SQL Server

Installing ASP.NET Membership Services database in SQL Server 2008

We will go through step-by-step how to create a database in SQL Server 2008 using SQL Server Management Studio then install ASP.NET membership services. So let's see that now.

  1. Right-click on the "Database" folder then click on "New Database".

    image1.png

  2. Open a new Database window. Click on "General" then provide a Database name then click on "OK".

    image2.png

  3. Now we will see our EmployeeDB database successfully created.

    image3.png

Installing ASP.NET Memberships Services Database in EmployeeDB Database

Before going to install ASP.Net membership, we need to know about aspnet_regsql.exe. The ASP.NET SQL Server Registration Tool (aspnet_regsql.exe) creates a Microsoft SQL Server database for use by the SQL Server providers, roles, profiles in ASP.NET, or to add or remove options from an existing database. We can run Aspnet_regsql.exe without any command-line arguments to run a wizard that will be explained in this article. We are installing or removing the database elements for the membership, role management, profile, Web Parts personalization, and health monitoring features using a wizard but are't covering the settings for session state and SQL cache dependency by the wizard. We can also run Aspnet_regsql.exe as a command-line tool to specify database elements for individual features to add or remove, using the options.

  1. Go to "C:\Windows\Microsoft.NET\Framework64\v4.0.30319" and click on aspnet_regsql.exe.

    image4.png

  2. The ASP.NET Server Setup Wizards starts; then click on the "Next" button.

    image5.png
  3. Check the radio button for "Configure SQL Server for application services" and click "Next".

    image6.png
  4. Use "SQL Authentication" and insert credentials for SQL Authentication and select the database to install ASP.Net services then click on the "Next" button.

    image7.png
  5. Check to confirm the settings; if the settings are OK then click on "Next" elsewhere click on "Previous".

    image8.png
  6. The database has been modified, click on "Finish".

    image9.png
  7. Go to SQL Server Management Studio and expand the EmployeeDB database then check the ASP.Net membership tables and views by expending the "Tables and Views" folder in the EmployeeDB database.

    image10.png

In the same manner we can look at the Stored Procedures by expanding the storedprocedure folder. So using this process we can enusre that the ASP.Net membership tables, views and Stored Procedures are created and our database is ready to use ASP.Net membership API.

In the next article, learn about Membership Services in Part 2. I will cover the following points:

  1. How to test this with application.
  2. How to create users.
  3. How to implement form authentication using membership.

Up Next
    Ebook Download
    View all
    Learn
    View all