[英]HttpContext.Current.User.Identity is null/empty in view of ASP.Net MVC site on one server but not the other
I have an ASP.Net MVC site that is running on an internal server. 我有一个在内部服务器上运行的ASP.Net MVC站点。 A view on the site uses
@HttpContext.Current.User.Identity.Name
to display the name of the user accessing the site via browser. 该站点上的视图使用
@HttpContext.Current.User.Identity.Name
来显示通过浏览器访问该站点的用户的名称。 The Authentication mode is set to Windows. 身份验证模式设置为Windows。
When run on one of our servers it works as expected. 在我们的一台服务器上运行时,它可以按预期工作。 When the same code is run on a second server the whole Identity object appears to be empty.
在第二台服务器上运行相同的代码时,整个Identity对象似乎为空。 This second server is a bit more isolated via firewall compared to the first server.
与第一台服务器相比,第二台服务器通过防火墙更加隔离。
What sort of rules could be preventing the Identity object from being filled? 什么样的规则可能会阻止Identity对象被填充?
In the web.config I also have 在web.config中,我也有
<authorization> <deny users="?" /> </authorization>
Which should prevent any anonymous users from accessing the site. 这样可以防止任何匿名用户访问该网站。 Since I am able to view the site I assume that it sees that I am authorized.
由于我能够查看该站点,因此我认为该站点表明我已获得授权。
Anonymous and Windows authentication were both turned on. 匿名和Windows身份验证均已打开。 Needed to turn off Anonymous.
需要关闭匿名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.