可能重复:
difference between http.context.user and thread.currentprincipal and when to use them?
在ASP.NET应用程序中,这两者有什么区别呢?
我知道HttpContext.User.Identity是在用户通过FormsAuthentication进行身份验证时设置的。但是Thread.CurrentPrincipal.Identity是什么时候设置的?
他们总是持有相同的价值吗?
对于无法访问HttpContext的应用程序的其他层,这种情况仍然成立吗?
发布于 2011-07-25 00:57:40
HttpContext.User.Identity是您的web应用程序中当前登录的用户。
Thread.CurrentPrincipal只在<authentication mode = "windows"/>应用时应用。这通常用于基于Windows的应用程序(Winforms,WPF.)
发布于 2011-07-25 01:34:31
如果使用HttpContext.User.Identity等于Thread.CurrentPrincipal
https://stackoverflow.com/questions/6810808
复制相似问题