Skip to content

Instantly share code, notes, and snippets.

@mattpresson
Created April 3, 2013 20:17
Show Gist options
  • Save mattpresson/5304833 to your computer and use it in GitHub Desktop.
Save mattpresson/5304833 to your computer and use it in GitHub Desktop.
[HttpPost]
public ActionResult LogOn(LogOnModel model, string returnUrl)
{
if (ModelState.IsValid)
{
if (MembershipService.ValidateUser(model.UserName, model.Password))
{
FormsService.SignIn(model.UserName, model.RememberMe);
if (!String.IsNullOrEmpty(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction("Index", "Home");
}
}
else
{
ModelState.AddModelError("", "The user name or password provided is incorrect.");
}
}
// If we got this far, something failed, redisplay form
return View(model);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment