public ActionResult Login(UserLogin userLogin) { UserLoginBLL objUserLoginBll = new UserLoginBLL(); if (ModelState.IsValid) { var loginInfo = objUserLoginBll.IsValid(userLogin); if (loginInfo != null) { SessionUtility.TBSessionContainer.UserID = loginInfo.AdminUserId; SessionUtility.TBSessionContainer.UserName = loginInfo.AdminUsername; FormsAuthentication.SetAuthCookie("Cookie", true); return(RedirectToAction("Index", "AdminUser", new { area = "Admin" })); } else { ModelState.AddModelError("", "Login data is incorrect!"); } } return(View()); }
public ActionResult Login(UserLogin userLogin, string returnUrl) { UserLoginBLL objUserLoginBll = new UserLoginBLL(); if (ModelState.IsValid) { var loginInfo = objUserLoginBll.IsValid(userLogin); if (loginInfo != null) { SessionUtility.STSessionContainer.UserID = loginInfo.UserDetailId; SessionUtility.STSessionContainer.UserName = loginInfo.Username; FormsAuthentication.SetAuthCookie(loginInfo.Username, true); return(RedirectToLocal(returnUrl)); } else { ModelState.AddModelError("", "Login data is incorrect!"); } } return(View("Login")); }