Exemple #1
0
        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {
            HttpCookie authCookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
            if (authCookie == null) return;
            FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);
            var userData = authTicket.UserData;

            CustomIdentitiy identity = new CustomIdentitiy(authTicket);
            CustomPrincipal principal = new CustomPrincipal(identity, userData);
            HttpContext.Current.User = principal;
            Thread.CurrentPrincipal = principal;
        }
Exemple #2
0
        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {
            HttpCookie authCookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];

            if (authCookie == null)
            {
                return;
            }
            FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);
            var userData = authTicket.UserData;

            CustomIdentitiy identity  = new CustomIdentitiy(authTicket);
            CustomPrincipal principal = new CustomPrincipal(identity, userData);

            HttpContext.Current.User = principal;
            Thread.CurrentPrincipal  = principal;
        }