Пример #1
0
        protected void Application_PostAuthenticateRequest(object sender, EventArgs e)
        {
            if (HttpContext.Current.User.Identity.IsAuthenticated &&
                HttpContext.Current.User.Identity.AuthenticationType == "Forms")
            {
                var formsIdentity = HttpContext.Current.User.Identity as FormsIdentity;
                var customIdentity = new UserIdentity() { Ticket = formsIdentity.Ticket };
                var customPrincipal = new UserPrincipal(customIdentity);

                HttpContext.Current.User = customPrincipal;
                Thread.CurrentPrincipal = customPrincipal;
            }
        }
Пример #2
0
 public UserPrincipal(UserIdentity identity)
 {
     this._identity = identity;
 }