How to Configure ASP.Net Membership Providers to Use Our Own Custom Database instead of aspnetdb?
Or
Create Membership Provider Database Schemas in our Application Database
By default, the required tables and stored procedures will be created in aspnetdb database. To create the required tables and stored procedures for the SqlMemberShip provider in our own database, there is a tool packed with framework called aspnet_regsql.exe[ASP.NET Sql Server Registration Tool]that is copied to WINDOWS\Microsoft.NET\Framework\2.0.xxxx folder. To invoke this tool, type aspnet_Regsql in visual studio command prompt. It will open a wizard which will takes us through a series of steps where we can provide information about the database to create the required objects. Refer the below figures. If we don't give the database name, the objects will be created in a new database called aspnetdb in the specified database server.
Refer the below figures which will guide us through the series of steps.
Finally, the connection string in web.config should be changed to connect our database.
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=BABULIVES;Initial Catalog=Test;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>
Note
If we want to have our own database schema and logic for creating, validating users and roles, then we need to create a custom membership and role provider.
|