public ActionResult LoginUser(TBL_LOGIN login) { if (ModelState.IsValid) { NewDBEntities ent = new NewDBEntities(); var v = ent.TBL_LOGIN.Where(a => a.UserName.Equals(login.UserName) && a.Password.Equals(login.Password)).FirstOrDefault(); if (v != null) { Session["UserName"] = v.UserName.ToString(); return RedirectToAction("AfterLogin"); } } return View(login); }