public ActionResult LogOn(LogOnViewModel model, string returnUrl) { if (this.ModelState.IsValid) { if (SimpleMembership.ValidateUser(model.UserName, model.Password)) { FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe); FormsAuthentication.RedirectFromLoginPage(model.UserName, true); if (this.Url.IsLocalUrl(returnUrl)) { return Redirect(returnUrl); } else { return RedirectToAction("Index", "Home"); } } } // If we got this far, something failed, redisplay form this.ModelState.AddModelError("", "Incorrect user name or password."); return View(model); }
public ActionResult LogOn() { LogOnViewModel model = new LogOnViewModel(); return View(model); }