public ActionResult Login(LogOn logon,string returnUrl) { if (!ModelState.IsValid) { return View(logon); } else { return null; } }
public ActionResult LogOn(LogOn model) { if (ModelState.IsValid) { if (sessionController.Logon(model.UserName, model.Password, model.RememberMe)) { log.Debug("Successfully logged on user: {0}", model.UserName); return RedirectToAction("ShowProfile"); } log.Debug("Could not log on user: {0} pass: {1}", model.UserName, model.Password); ModelState.AddModelError("System", "The user name or password provided is incorrect."); } return View(model); }