Reputation: 1036
So the critical parts of my web config looks like:
<connectionStrings>
<add name="AppConnection" connectionString="Server=100.100.100.100;Database=AppDB;User Id=user;Password=password;" providerName="System.Data.SqlClient"/>
<add name="MemberConnection" connectionString="Server=100.100.100.100;Database=aspnetdb;User Id=user;Password=password;" providerName="System.Data.SqlClient"/>
</connectionStrings>
and within the membership providers section:
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add name="SqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="MemberConnection"
applicationName="Consulate"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
</providers>
</membership>
As written, when I register, it connects to the incorrect database.
However, if I change all instances of "MemberConnection" to "DefaultConnection" it works.
Why does it have to use "Default" as part of the connection string name?
Upvotes: 3
Views: 1307
Reputation: 1036
Within IdentityModels.cs, there the constructor for ApplicationDbContext inherited a hard-coded "DefaultConnection" string.
Changed that to the connection string that correlates to the aspnetdb (membership) and it worked.
Upvotes: 2