public ActionResult Index(Admin p) { DbCVEntities db = new DbCVEntities(); var root = db.Admin.FirstOrDefault(x => x.UserName == p.UserName && x.Password == p.Password); if (root != null) { FormsAuthentication.SetAuthCookie(root.UserName, false); Session["UserName"] = root.UserName.ToString(); return(RedirectToAction("Index", "Experience")); } else { return(RedirectToAction("Index", "Login")); } }