ASP.NET 位置元素覆盖行为
假设我的 web.config 中有以下内容(为简洁起见,省略了大部分文件):
<configuration>
<location path="somefolder/somepage.aspx">
<system.web>
<authorization>
<allow roles="SomeRole" />
<deny users="*" />
</authorization>
</system.web>
</location>
<system.web>
<authorization>
<deny users="?"/>
</authorization>
<!--
Lots of other settings.
-->
</system.web>
</configuration>
如果我导航到 somefolder/somepage.aspx,其访问权限仅限于 SomeRole 角色中的用户(并且我是该角色的成员) ,评论区的设置会怎么样?即使它们位于指定页面的位置元素之外,它们是否仍然适用?
Assume I have the following in my web.config (most of the file omitted for brevity):
<configuration>
<location path="somefolder/somepage.aspx">
<system.web>
<authorization>
<allow roles="SomeRole" />
<deny users="*" />
</authorization>
</system.web>
</location>
<system.web>
<authorization>
<deny users="?"/>
</authorization>
<!--
Lots of other settings.
-->
</system.web>
</configuration>
If I navigate to somefolder/somepage.aspx, whose access is limited to users in the SomeRole role (and I am a member of that role), what happens with the settings in the commented area? Do they still apply, even though they are outside the location element where the page is specified?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,它们仍然适用,只要它们没有包含在自己的
元素中。Yes, they still apply, provided that they aren't enclosed in
<location>
elements of their own.