I have an MVC4 based web portal that using the membership to authenticate users ONLY(no creating new users, no validating passwords).
Here is a screenshot of tables that used to authenticate users:
Here is the action method that triggered when a user is trying to authenticate:
[HttpPost]
public ActionResult Login(string username, string password, string[] rememberMe, string returnUrl)
{
if(Membership.ValidateUser(username, password))
{
if (rememberMe != null)
{
FormsAuthentication.SetAuthCookie(username, true);
}
Response.Redirect(returnUrl);
}
ViewBag.ErrorMessage = "wrong credentials";
return View();
}
Here is web config:
<membership defaultProvider="AspNetSqlMembershipProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add name="AspNetSqlMembershipProvider"
connectionStringName="SiteSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
applicationName="/"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="8"
minRequiredPasswordLength="4"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d43e4e" />
</providers>
</membership>
I also have a new database that is created by asp.net identity 2.0:
My task is to make user authentication against new tables (i.e I need the membership to use for authentication, tables that created by asp.net identity 2.0).
So, for this purpose, I think I need to customize the membership to read the new tables.
My question is it possible to make changes on the membership that it will read asp.net identity 2.0 for authentication?