When you need to run ASP.Net Membership from a Shared Server
One of the main advantages of ASP.NET is it’s out of the box user management system. With ASP.NET membership, the developer has a proven service for validating and storing user credentials. If you’re interested in all the possibilities of this technology, read this MSDN article.
Because the IIS and the SQL Server work their magic in the background and the user management schema is not exposed in the application’s database, the developer can often feel perplexed at the prospect of migrating their application to a shared server. In those cases, the user data needs to be stored on a specific database and not the common one used by the IIS.
Take a breath: it’s easy.
1. Migrating Schema to Remote DB
First, you’ll need to migrate the local application services scheme from your developer machine and onto the destination DB. For this, you’ll need remote access to that database, which is often provided by the host. In fact, I noticed that I need to be logged into the DB on Microsoft’s SQL Server Management Studio (express) for this to work.
[Note: I’m not sure if logging into the server remotely is necessary, since I could not find anything written about this, but it was the only way that it worked for me]
Next you need to fire up the command prompt, and navigated to: C:\WINDOWS\Microsoft.NET\Framework\[framework version]
Then you need to run: aspnet_regsql.exe -S DBServerName -U DBLogin -P DBPassword -A all -d DBName
2. Updating the ConnectionStrings
Go to your Web.config, find the <connectionStrings> attribute, and add the following to it:
And you’re done.