public ActionResult Login(LoginModel login) { log.Info(">>>> Login method entered"); if (!ModelState.IsValid) { return(View(login)); } UserDetails userDetail = userComponent.LoginUser(login); if (userDetail == null) { ModelState.AddModelError("EmailId", "Email ID/Password Incorrect!!"); } else { Session["userName"] = userDetail.FirstName; Session["Email"] = userDetail.EmailId; Session["UserRole"] = userDetail.UserRole; return(RedirectToAction("Index", "Home")); } return(View(login)); }