public ActionResult Index(user u) { envanterDBEntities db = new envanterDBEntities(); var data = db.SP_getLoginDetails(u.user_userName, u.userPassword); foreach (var item in data) { if (item.Username == u.user_userName && item.Password == u.userPassword) { Session["Name"] = u.user_userName; return(RedirectToAction("Main")); } } return(View()); }