public ActionResult Login(Login model) { using (var context = new EWT_PrivateSQREntities1()) { bool isValid = context.Login.Any(x => x.UserName == model.UserName && x.Password == model.Password); if (isValid) { FormsAuthentication.SetAuthCookie(model.UserName, false); return(RedirectToAction("Dashboard", "Admin")); } ModelState.AddModelError("", "Please Enter The Valid Credential."); return(View()); } }