context.Request.ServerVariables [“LOGON_USER”]为字符串为空

时间:2011-04-07 13:54:23

标签: asp.net security windows-7 iis-7.5

我在windows7 enterprise iis7.5上运行web应用程序。 我的webapp使用Windows身份验证和带有identity=applicationpoolIdentity的ASP.NET v4.0应用程序池。

我想用context.Request.ServerVariables["LOGON_USER"]获取登录用户名,但它的字符串为空。为什么呢?

感谢。

1 个答案:

答案 0 :(得分:1)

请尝试使用context.User.Identity.Name

HTH。