窗口内置身份验证中的混乱(web.config)
我目前正在处理我的 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
授权元素按照配置文件中给出的顺序进行评估。
在您的示例中,用户将被拒绝,因为
拒绝
条目在列表中早于允许
条目。请注意,您的问题指的是 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 theallow
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.