public ActionResult Login(tblLogin t)//this method checks the credentials of users and validates them { if (ModelState.IsValid) { string user = Request.Form["UserId"]; string password = Request.Form["Password"]; tblLogin t1 = Dbclass.loginn(user, password); if (t1 != null) { Session["user"] = t1.UserId; //sessionvariables are used to remove that particular session when userlogouts Session["UserType"] = t1.UserType; if (t1.UserType == "Admin") { return(RedirectToAction("Login1")); } else if (t1.UserType == "Customer") { Session["customerid"] = t1; Session["id"] = t1.UserId; return(RedirectToAction("SearchHotelNew")); } else { return(RedirectToAction("Login")); } } else { ViewBag.msg = "Invalid credentials"; } return(View("Login")); } return(View("Login")); }