public ActionResult Login(LogOnModel model) { if (ModelState.IsValid) { if (auth.CheckUser(model.UserName, model.Password) != null) { FormsAuthentication.SetAuthCookie(model.UserName, true); return(RedirectToAction("Index", "Races")); } else { ModelState.AddModelError("", "The username or password is incorrect, please try again"); } } return(View(model)); }