I'm transfering an existing ASP.net forms site to MVC 5 and I can't get the user authentication to work. I can't understand what it is that I'm missing. What I've added the database and the connection string and made sure they work. I then pasted the membership part of my previous web.config to the new project:
<membership defaultProvider="MyProvider" hashAlgorithmType="SHA1">
<providers>
<add name="MyProvider"
connectionStringName="LocalSqlServer"
applicationName="/"
description=""
requiresUniqueEmail="false"
enablePasswordRetrieval="true"
requiresQuestionAndAnswer="false"
passwordFormat="Clear"
minRequiredPasswordLength="4"
minRequiredNonalphanumericCharacters="0"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
When I try to authenticate using Membership.ValidateUser(user.Username, user.Password) it always returns false. Putting a break point at the Membership shows that it uses "MyProvider" but I noticed that it used another hash algorithm so I manually added SHA1. At least this is what I think SQL Membership Provider is using.
So what am I missing here? It's probably something major since nothing seems to work. I even tried inserting the hashed password from the database instead of the one from the one from the model (user.Password) while messing around with the passwordFormat in the web.config without any difference.
Any suggestions are most welcome! Membership providers are really not my strong side.