【问题标题】:What is this <location> element referred to in <configSections><section> in app.configapp.config 的 <configSections><section> 中引用的这个 <location> 元素是什么
【发布时间】:2018-09-25 14:24:45
【问题描述】:
我正在创建一个ConfigurationSection。在给出的示例中,<section> 属性的属性allowLocation 设置为true。看着what this allowLocation means,我还是一头雾水。在那一页上写着Determines whether the section can be used within the <location> element.。我找不到这个<location> 元素的文档。
这个<location> 元素有什么作用?它是干什么用的?
【问题讨论】:
标签:
c#
app-config
configurationsection
【解决方案1】:
给你!
指定子配置设置应用到的资源并锁定配置设置,防止设置被子配置文件覆盖。
和
location 元素可以包含其他元素,以将配置设置应用于特定资源或锁定配置设置。
示例:
<configuration>
<location path="Logon.aspx">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
</configuration>
Source @ msdn