1

我的 Web 应用程序使用 Windows 身份验证。所有其他身份验证方法均被禁用。

一开始就有效;User.Identity.Name 返回“MYDOMAIN\myuser”。但是,如果我等待 131 秒(是的,我计时了,尽管我不确定它总是需要那么长时间)并重新加载页面,User.Identity.IsAuthenticated = false 和 User.Identity.Name = ""。在这一点上,我可以重新加载页面,它再次工作,另外 131 秒不活动。

web.config 的相关部分:

<authentication mode="Windows" />
<authorization> 
  <deny users="?" /> 
</authorization>
<identity impersonate="false" />
...
<security>
  <authentication>
    <windowsAuthentication enabled="true" />
    <anonymousAuthentication enabled="false" />
  </authentication>
</security>

更多信息,可能相关:

我的解决方案部署到两个不同的 IIS 应用程序。第一个是内部用户;它只是使用 Windows 身份验证。第二个是针对外部用户的;它使用匿名身份验证(仅在根文件夹中)和表单身份验证。我只是对内部站点有问题。

4

1 回答 1

1

Account 文件夹下的 web.config 文件允许匿名身份验证(我发布的问题是主 web.config)。不知道这是怎么发生的,但删除它可以解决问题。

于 2012-10-04T14:17:40.653 回答