public ActionResult AdminLogin(string UserName, string Password) { ServiceLayer serviceLayer = new ServiceLayer(); bool str = serviceLayer.AdminAuthentications(UserName, Password); if (str) { FormsAuthentication.SetAuthCookie(UserName, false); return(RedirectToAction("Index", "Admin")); } else { ModelState.AddModelError("", "Invalid Username or Password"); return(RedirectToAction("AdminLogin")); } }