protected void Application_OnPostAuthenticateRequest(object sender, EventArgs e) { IPrincipal user = HttpContext.Current.User; if (user.Identity.IsAuthenticated && user.Identity.AuthenticationType == "Forms") { try { FormsIdentity formIdentity = user.Identity as FormsIdentity; ShopIdentity identity = new ShopIdentity(formIdentity.Ticket); ShopPrincipal principal = new ShopPrincipal(identity); HttpContext.Current.User = principal; Thread.CurrentPrincipal = principal; } catch { } } }
public ShopPrincipal(ShopIdentity id) { identity = id; }