当我尝试在我的项目中重置密码时,它会抛出异常. 这是我的模特
public class ResetPasswordConfirmModel
{
public string Toke { get; set; }
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "New password")]
public string NewPassword { get; set; }
[DataType(DataType.Password)]
[Display(Name = "confirm new password")]
[System.Web.Mvc.Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
Run Code Online (Sandbox Code Playgroud)
账户管理员
[AllowAnonymous]
[HttpPost]
public ActionResult ResetPasswordConfirmation(ResetPasswordConfirmModel model)
{
if(WebSecurity.ResetPassword(model.Toke,model.NewPassword))
{
return RedirectToAction("PasswordResetSuccess");
}
return RedirectToAction("PasswordResetFailure"); …Run Code Online (Sandbox Code Playgroud)