BookMgnt.MvcApplication.Application_PostAuthenticateRequest C# (CSharp) Метод

Application_PostAuthenticateRequest() защищенный Метод

protected Application_PostAuthenticateRequest ( Object sender, EventArgs e ) : void
sender Object
e System.EventArgs
Результат void
        protected void Application_PostAuthenticateRequest(Object sender, EventArgs e)
        {
            HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
            if (authCookie != null)
            {

                FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);

                CustomPrincipalSerializeModel serializeModel = JsonConvert.DeserializeObject<CustomPrincipalSerializeModel>(authTicket.UserData);
                CustomPrincipal newUser = new CustomPrincipal(authTicket.Name);
                newUser.UserId = serializeModel.UserID;
                newUser.roles = serializeModel.Roles;

                HttpContext.Current.User = newUser;
            }
        }