By default, it seems like my web application is using LocalSqlServer
as the connection string to use for any application services such as Membership/Roles/Authentication/etc.
Is there any way I can change what the default connection string should be? It seems so arbitrary that the default is "LocalSqlServer" and the only way I was able to find this was by googling for this for about two hours.
I don't want to be forced to have to name my server connection "LocalSqlServer" and I have no idea if this is a preexisting item that I might be overwriting.
Yes, these connection strings can be set in web.config:
Membership
<membership defaultProvider="SqlMembershipProvider">
<providers>
<add
name="SqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="MyMembershipConnectionString"
/>
</providers>
</membership>
Roles
<roleManager defaultProvider ="SqlRoleProvider" >
<providers>
<add
name="SqlRoleProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="MyRolesConnectionString"
/>
</providers>
</roleManager>
See here for more info: How to: Use the ASP.NET Membership Provider
2 things.
Look for, or add a "connectionStringName" property in your membership config.
Here is an example that uses it
<system.web>
...
<membership defaultProvider="MembershipADProvider">
<providers>
<add
name="MembershipADProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="YOUR CONN STRING"
connectionUsername="<domainName>\administrator"
connectionPassword="password"/>
</providers>
</membership>
...
</system.web>
And you need to setup the conn sting of course
<connectionStrings>
<add name="YOUR CONN STRING"
connectionString=
"[ANY ConnectionSTRIN]" />
</connectionStrings>