ASP.NET membership and roles control creates a default database ‘ASPNETDB.MDF' for storing and retrieving users and roles. If you already have a database and want to use that for the login controls then here is what you have to do
For using the exisiting database for the login control we have to configure it for ASP.NET memebership, profile and role management. Which means that we have to add new tables for the exisiting database. This can be done using the ASP.NET SQL Server Registration Tool (aspnet_regsql.exe). You can find this in “%WINDOWS%\Microsoft.NET\Framework\v2.0.50727″ folder.
If you are using a SQL Server Standard Edition then follow these steps:
1. Run the aspnet_regsql.exe tool and You’ll get a screen asking whether you want to Configure a SQL server for the application service or You want to remove the application service from a databse. Choose Configure a SQL server for application services

2. Then put in your Server name. select the databae you want to configure

3. Click Next and you’ll be asked to confirm the settings

And you are done.
If you are using SQL server Express Edition then you’ll be using a database present in the App_Data folder in your project. For this the server is:localhost\sqlexpress . And the database name is its path. Lets say you have a database called MyDB.mdf in your App_Data folder then the name would be “C:\VisualStudio\Website\App_Data\MyDB.mdf “. Follow these steps to complete the process
1. To use the database in the tool we need to first attach it to the server which can be done by running the tool from command-line with specified arguments
sqlcmd -S localhost\SQLExpress -Q “EXEC sp_attach_db ‘Foobar’, N’C:\VisualStudio\Website\App_Data\MyDB.mdf‘”
where FooBar is a name you are giving your databse in the server. You can change it to anything you want.
2. Then run the following command
aspnet_regsql.exe -S localhost\SQLExpress -d Foobar -E -A all
3. Tables will be added to your database and you can use it for the membership and roles control
Once configuring the databases is done you are ready to get all login-related queries to your database. But the Default SQL server membership providers (SqlMembershipProvider, SqlRoleProvider, SqlProfileProvider) will send queries to ASPNETDB.MDF.
We have to modify the web.config file. Here is a web.config file configured to use an exisiting database MYDb.mdf
<configuration>
<connectionStrings>
<add name="MyDB" connectionString="..." />
</connectionStrings>
<system.web>
... authentication & authorization settings ...
<roleManager enabled="true"
defaultProvider="CustomizedRoleProvider">
<providers>
<add name="CustomizedRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="MyDB" />
</providers>
</roleManager>
<membership defaultProvider="CustomizedMembershipProvider">
<providers>
<add name="CustomizedMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="MyDB" />
</providers>
</membership>
</system.web>
</configuration>