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; } }
public UserPrincipal(UserIdentity identity) { this._identity = identity; }