Question

I created a custom membership provider (empty yet, only the ValidateUser method has code).

    public override bool ValidateUser(string username, string password)
    {
        return true;
    }

lol.

And my web.config has this tag:

<membership defaultProvider="LigaeDesligaMembershipProvider">
  <providers>
    <clear/>
    <add name="CoolMembershipProvider"
         type="CoolProject.Web.Memberships.CoolMembershipProvider, CoolProject.Web"
         enablePasswordReset="true"/>
  </providers>
</membership>

But when I call this:

  if (Membership.ValidateUser(username, password))
  {
      FormsAuthentication.SetAuthCookie(username, persistcookies);
      return true;
  }

I got an error "Can not connect to the database from SQL Server."

The application doesnt hit the breakpoint inside my custom Membership and I guess is using another membership.

I'm using MVC5 and EF6.

Please, tell me too if I'm wrong in my approach.

Was it helpful?

Solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top