To configure an existing site to use ASP.Net Membership, but storing the data in the site database rather than creating an MDF in the APP_Data folder.
Run the utility c:\windows\microsoft.net\framework\v2.0.50727\aspnet_regsql
Follow the wizard to connect to the relevant server/database, this will need to be repeated for both test and production.
In the <system.web> section of the web.config ensure that an entry as below is included…
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add
name="SqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="SecurityConnection"
applicationName="CHANGETHIS"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
requiresUniqueEmail="true"
passwordFormat="Hashed" />
</providers>
</membership>
In the <connectionStrings> section add the appropriate connection string with a key of “SecurityConenction”
While editing the site within VS2005, from the WebSite menu selecti ASP.Net Configuration. This will open a web page that allows you to create users and rules for the application. Rules that are defined are stored in the Web.Config, so do this for the development site only, as you won’t have access to the live config file. Any folders with restricted access will also have a web.config file created in them, these will need to be promoted to live.
To release to production, change your security connection to point to the production database, set up the relevant users, but not the rules. Then when promoting code to production manually update the root config with the required authorisation, membership and connection strings, that can be taken from the development config file.