窗口内置身份验证中的混乱(web.config)

发布于 2025-01-05 20:13:35 字数 347 浏览 2 评论 0原文

我目前正在处理我的 asp.net 项目。我使用 web.config 设置来允许和拒绝服务!

它工作得很好!现在我收到一些查询(仅供参考),如果我使用拒绝和允许身份验证会发生什么?

我的代码看起来像这样,

<system.web>
     <authorization>
          <deny users="user_name" />
          <allow users="user_name" />
     </authorization>
</system.web>

提前致谢!

I am currently working with my asp.net project. I use web.config settings to allow and deny services !

It works totaly fine ! Now I got some query ( just for knowledge) that if I use deny and allow authentication both what will happen ?

My code seems like that

<system.web>
     <authorization>
          <deny users="user_name" />
          <allow users="user_name" />
     </authorization>
</system.web>

Thanks in advance !

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

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

发布评论

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

评论(1

分开我的手 2025-01-12 20:13:35

授权元素按照配置文件中给出的顺序进行评估。

在您的示例中,用户将被拒绝,因为拒绝条目在列表中早于允许条目。


请注意,您的问题指的是 ASP.NET URL 授权行为(即 system.web\authorization 中定义的设置)。 IIS URL 授权的行为完全不同。请参阅此处的“差异表”。

Authorization elements are evaluated in the order they are given in the configuration file.

In your example, the user would be denied, as the deny entry is earlier in the list than the allow entry.


Note that your question is referring to ASP.NET URL Authorization Behaviour (i.e. the settings defined in system.web\authorization). The behaviour of IIS URL Authorization is quite different. See the "Differences Table" here.

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