Next up (typical, you wait for one new blog post to arrive, then four come at once) adding a sql server membership database. One of the problems with asp.net configuration tool for the baby web server Visual Studio 2005 supplies is it can't understand you have SQL server installed. It appears to want to create new SQL Express databases. So in order to use SQL server for membership, roles and all the other goodness asp.net provides you need to do the following;

  • Install the membership databases into SQL by running aspnet_regsql.exe
  • Add the connection string information manually to your web.config file;

    <connectionString>
      <add name="connectionName"
        connectionString="Data Source=server;Initial Catalog=database;Integrated Security=SSPI;" />
    </connectionStrings>

  • Manually add the configuration database information to your web.config file, overriding the sql express setup in machine.config;

    <system.web>
     <membership>
      <providers>
       <clear />
       <add connectionStringName="connectionName"
        enablePasswordRetrieval="false"
        enablePasswordReset="true"
        requiresQuestionAndAnswer="false"
        applicationName="/"
        requiresUniqueEmail="true"
        passwordFormat="Hashed"
        maxInvalidPasswordAttempts="5"
        passwordAttemptWindow="10"
        passwordStrengthRegularExpression=""
        name="AspNetSqlMembershipProvider"
        type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        minRequiredPasswordLength="1"
        minRequiredNonalphanumericCharacters="0" />
      </providers>
     </membership>
    </system.web>


You can now setup users and permissions via the web admin tool.