public ActionResult Index(UserLogin model, string returnUrl) { if (ModelState.IsValid) { JSONReadWrite UM = new JSONReadWrite(); string password = UM.GetUserPassword(model.UserName); if (string.IsNullOrEmpty(password)) { ModelState.AddModelError("", "The user login or password provided is incorrect."); } else { if (model.PassWord.Equals(password)) { FormsAuthentication.SetAuthCookie(model.UserName, false); return(RedirectToAction("AdminOnly", "Home")); } else { ModelState.AddModelError("", "The password provided is incorrect."); } } } return(View(model)); }