是什么在asp.net之间HttpContext.Current.User和Thread.CurrentPrincipal中的区别? [英] What's the difference between HttpContext.Current.User and Thread.CurrentPrincipal in asp.net?

查看:338
本文介绍了是什么在asp.net之间HttpContext.Current.User和Thread.CurrentPrincipal中的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我觉得冠军是非常明显的。

Well, I think the title is clear enough.

推荐答案

最大的区别是,他们不必是相同的。

The biggest difference is that they do not have to be the same.

一般而言,HttpContext.Current.User是登录用户,同时是Thread.CurrentPrincipal中的工作进程标识。

Generally speaking, HttpContext.Current.User is the logon user while Thread.CurrentPrincipal is the worker process identity.

在IIS 5.x中,通过Thread.CurrentPrincipal中默认ASPNET。在IIS 6及以上,通过Thread.CurrentPrincipal中默认为网络服务或应用程序池帐户。

On IIS 5.x, Thread.CurrentPrincipal by default is ASPNET. On IIS 6 and above, Thread.CurrentPrincipal by default is Network Service or application pool account.

要使它复杂,如果启用ASP.NET模拟,然后他们两个将是相同的登录用户。 :)

To make it complex, if you enable ASP.NET impersonation, then both of them will be the same as the logon user. :)

尝试阅读关于这一主题一些非常好的书籍和微软MSDN文章

Try to read some really good books on this topic and Microsoft MSDN articles,

<一个href=\"http://msdn.microsoft.com/en-us/library/ms998351.aspx\">http://msdn.microsoft.com/en-us/library/ms998351.aspx

另一个建议是使用调试器附加到工作进程,并检查这些在运行时。这可以给你一个更好看。

Another suggestion is to use a debugger to attach to the worker process and check those at runtime. That can give you a better look.

这篇关于是什么在asp.net之间HttpContext.Current.User和Thread.CurrentPrincipal中的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆