经典ASP启用Windows身份验证但Request.ServerVariables(“LOGON_USER”)有时会返回错误的用户名

时间:2015-07-23 06:54:16

标签: apache asp-classic iis-7

我在IIS 7中部署了一个经典的ASP。启用了Windows身份验证,并禁用了其他所有身份验证。因此页面不需要任何登录,服务器能够确定NTADMIN用户名。

我们已经进行了Apache重写,因此可以使用https://www-site/app/page.asp之类的别名访问该页面,而不是像https://ntp123:8090/app/page.asp那样访问它;重写是这样的:

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/app https://%{HTTP_HOST} %{REQUEST_URI} [R,L]
ProxyPass /app http://ntp123:8090/app/ 
ProxyPassReverse /app http://ntp123:8090/app/ 

大多数情况下,也许99%的时间代码返回正确的" NTADMIN \ user":

LoginName = Request.ServerVariables("Logon_User")

但是,有几种情况下代码获取了错误的NTADMIN用户名。我试图通过谷歌寻找任何类似的问题,但大多数都没有显示决议。

也许这里的 ASP / IIS专家可能有解决方案?

1 个答案:

答案 0 :(得分:0)

It turns out the culprit was Apache HTTP Rewrite, because from observation of the IIS logs, the client IP address is always the same, in this case the Apache Server. It looks like it either has some caching issue or it's just not compatible with IIS's windows authentication. Either way, by removing this, the issue is no longer encountered.