One of the least documented features in ASP.NET is the way to move the user access and profiles tables in aspnetdb.mdf to a production SQL Server. Although aspnetdb.mdf can be used in production, it is not recommended. This is done in 2 steps, first create the structure (tables, views and stored procedures) in the database, and second point the connection strings in the solution to that database.
The structure should be created automatically, to do so open the command line by opening the Run dialog box and enter cmd. Then change to the directory C:\Windows\Microsoft.NET\Framework\v2.0.50727. Note that the last directory’s name may be different, just make sure it’s v2.0, which signifies version 2.0 of the .NET Framework. In this directory run the executable called aspnet_regsql.exe. When run without arguments a wizard will start. Although I never had trouble with this tool before, I would still advice to backup the database before continuing the wizard, if its not empty. The following screens show the input pages of the wizard:



To let the solution use the database for user access and profiles, a hidden connection string called LocalSqlServer has to be removed and added again with the new settings. The following code example does that.


Hi
I ran the wizard as as given in this page, but it created an empty database, instead of copying my existing database.
How do i copy my database to serever?
Thanks
Joyce
Hi Joyce, the wizard creates the structure (tables, views and stored procedures) needed to use the database for ASP.NET memberships. There are 3 ways you could copy the database. You could copy the database’s mdf and ldf files to the new location and attach it using SQL Server Management Studio, backup the database and restore it in the new location, or generate the SQL statements needed to create the structure and run it in the new location.