I have to implement “Your Account is Locked!” message for the SqlMembershipProvider in MVC2 project.
How I can do it?
Basically my code to logon looks like:
[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);
}
Is it just like normal membership?
MSDN: Membership.GetUser(string username)
–Side Note–
The order in which you do authentication is really a Security & UX thing. I’d suggest the following pseudo-code (but I’m no expert):