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? Commented Oct 27, 2014 at 20:26
  • @ErikPhilips Default Commented 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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.