Thread.CurrentPrincipal & HttpContext.Current.User

据说要这样写才稳妥

// 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;

posted @ 2014-10-22 11:14  队长  阅读(794)  评论(0编辑  收藏  举报