我在登录时解密密码。但是登录失败,因为crypto.Compute每次都生成新的通行证,这不等于存储在db中的加密密码。这是我的代码。控制器
[HttpPost]
public ActionResult LogIn(Authentication log)
{
var crypto = new SimpleCrypto.PBKDF2();
Login ULogin = new Login();
if (ModelState.IsValid)
{
if
(ULogin.Validate(log.Email,crypto.Compute(log.Password)))
{
// FormsAuthentication.SetAuthCookie(log.Email, log.RememberMe);
return RedirectToAction("Index", "Home");
}
}
else ModelState.AddModelError("", "Login failed..");
return View();
}