我必須爲MVC2項目中的SqlMembershipProvider實現「您的帳戶鎖定!」消息。通知用戶有關帳戶鎖定,即在ASP .NET MVC2
我該怎麼做?
基本上我的代碼登錄的樣子:
[RequireHttps]
[HttpPost]
public ActionResult LogOn(LogOnModel model, string returnUrl)
{
if (ModelState.IsValid)
{
if (MembershipService.ValidateUser(model.UserName, model.Password))
{
FormsService.SignIn(model.UserName, model.RememberMe);
UserProfile profile = UserProfile.GetUserProfile(model.UserName);
//....
}
else
{
ModelState.AddModelError("", "The user name or password provided is incorrect.");
}
}
return View(model);
}
有我的行之前使用它:如果(MembershipService.ValidateUser(model.UserName,model.Password)) {...還是怎麼樣? –
是的,你想在試圖簽署用戶之前使用它*。 –