IIS7.5:当文件夹被 URL 授权阻止时,如何防止提示输入凭据

发布于 2024-12-10 14:58:43 字数 1002 浏览 0 评论 0原文

我设法通过以下方法在 IIS7 中使用 URL 授权来保护文件夹结构:

<location path="Reports"> 
  <system.webServer> 
    <security> 
      <authorization> 
        <remove users="*" roles="" verbs="" /> 
      </authorization> 
    </security> 
  </system.webServer> 
</location> 

<location path="Reports/Company1"> 
  <system.webServer> 
    <security> 
      <authorization> 
        <add accessType="Allow" users="User1"/> 
      </authorization> 
    </security> 
  </system.webServer> 
</location> 

<location path="Reports/Company2"> 
  <system.webServer> 
    <security> 
      <authorization> 
        <add accessType="Allow" users="User2" /> 
      </authorization> 
    </security> 
  </system.webServer> 
</location> 

现在我的问题是,当 Company1 中的 User1 尝试访问 Company2 文件夹中的文件时,系统会提示它输入凭据。我希望他收到“访问被拒绝”消息。我尝试在第二个位置标签中添加 a 但没有成功。

I managed to secure a folder structure with URL authorization in IIS7 with the following :

<location path="Reports"> 
  <system.webServer> 
    <security> 
      <authorization> 
        <remove users="*" roles="" verbs="" /> 
      </authorization> 
    </security> 
  </system.webServer> 
</location> 

<location path="Reports/Company1"> 
  <system.webServer> 
    <security> 
      <authorization> 
        <add accessType="Allow" users="User1"/> 
      </authorization> 
    </security> 
  </system.webServer> 
</location> 

<location path="Reports/Company2"> 
  <system.webServer> 
    <security> 
      <authorization> 
        <add accessType="Allow" users="User2" /> 
      </authorization> 
    </security> 
  </system.webServer> 
</location> 

Now my problem is that when User1 from Company1 tries to access a file from the Company2 folder, it gets prompted for credentials. I would like that he receives an "access denied" message. I tried to add a in the second location tag but without success.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瀞厅☆埖开 2024-12-17 14:58:43

据我所知不可能。您至少需要尝试验证用户,然后才能显示访问被拒绝(可能通过自定义错误)。然而,在验证开始之前,也无法确定是哪个用户。

Not possible as far as I can see. You need to at least attempt to verify the user before you can display the access denied (by means of custom errors perhaps). However, before this verification has started, there is also no way to determine which user it is.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文