3

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?

2
  • What Membership provider are you using? Default, Simple, Identity? Oct 27, 2014 at 20:26
  • @ErikPhilips Default
    – duckmike
    Oct 27, 2014 at 20:31

1 Answer 1

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.