据说要这样写才稳妥
// This principal will flow throughout the request.
VoyagerPrincipal principal = new VoyagerPrincipal(yada, yada, yada);
// Attach the new principal object to the current HttpContext object
HttpContext.Current.User = principal;
// Make sure the Principal is in sync
System.Threading.Thread.CurrentPrincipal = System.Web.HttpContext.Current.User;
Thread.CurrentPrincipal & HttpContext.Current.User
时间: 2024-10-16 17:32:53