Database Authentication Setup

Database Authentication Setup


First you need to create an ASP.NET user database on the server using the aspnet_regsql.exe tool.

You can see all the different options and the location of the executable in this MSDN article but the preferred syntax is this:

aspnet_regsql.exe -E -S localhost -A m

-E means you will log in to the SQL Server using your Windows credentials
-S specifies the localhost as the SQL Server address
-A m specifies that we only need the Membership database

The following example shows a complete command line for registering on a different server with a custom database name using an SQL Server authentication.

C:\Windows\Microsoft.NET\Framework\v2.0.50727>aspnet_regsql.exe -S myServer -U sa -P password -A m -d myUserDb


Now you need to configure the membership provider, especially the database connection string. For all the options see this MSDN article.

Provider Settings

    <membership defaultProvider="sqlMembershipProvider">
            <clear />
                    type="System.Web.Security.SqlMembershipProvider, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                    applicationName="ORIGAM" />
    <add name="userDatabase" connectionString="Server=serverName;database=scmembers;Integrated Security=SSPI" providerName="System.Data.SqlClient" />

If you have other applications with which you want to share the user database and passwords, you need to specify the same applicationName.