public ActionResult Index(LoginViewModel model) { if (ModelState.IsValid) { var user = this.authService.AuthenticateUser(model.UserName, model.Password.Hashstring()); if (user != null) { FormsAuthenticationUtility.SetFormsAuthenticationTicketFromLoginUser(user); return(RedirectToAction("Index", "Home")); } } ViewData["errorMessage"] = "The user name or the password are incorrect, please check your user name and password and try again."; return(View()); }
void Application_PostAuthenticateRequest(object sender, EventArgs e) { FormsAuthenticationUtility.GetFormsAuthenticationUserFromAuthenticationCookies(); }