Is it possible to have location authorization nodes in a web.config be external?
是否可以在web中具有位置授权节点。配置外部?
Such that I could take all of the nodes simlar to
这样我就可以把所有的结点都简化到
<location path="elmah.axd">
<system.web>
<authorization>
<allow roles="Administrator" />
<deny users="*" />
</authorization>
</system.web>
</location>
<location path="Admin">
<system.web>
<authorization>
<allow roles="Administrator, Representative" />
<deny users="*" />
</authorization>
</system.web>
</location>
And move them outside of the web.config or something simlar? I find these nodes at an extreme amount of noise to a web.config when they're relatively static. Normally my approach would be to config source something like this but since it falls under the root node I'm not sure of it's possible with these nodes.
把它们移出网络。配置什么的simlar吗?我发现这些节点在网络上的噪声非常大。配置,当它们是相对静态的。通常情况下,我的方法是配置源文件,但由于它位于根节点下,所以我不确定这些节点是否有可能。
1 个解决方案
#1
2
you can create a web.config inside each folder with appropriate security settings, all named web config.
你可以创建一个网络。在每个文件夹内配置适当的安全设置,所有命名为web配置。
- ~/members/web.config
- ~ / / web . config
- ~/members/vip/web.config
- ~ /会员/贵宾/ web . config
like:
如:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<authorization>
<allow roles="developers" />
<allow roles="testers" />
<deny users="*" />
</authorization>
</system.web>
</configuration>
Per folder you can have one original web.config, so it would be a good approach to move resources (handlers, pages, controls) "per-authorazition" to that according folder.
每个文件夹可以有一个原始web。配置,所以这将是一个很好的方法来移动资源(处理程序、页面、控件)根据文件夹的“每授权”。
#1
2
you can create a web.config inside each folder with appropriate security settings, all named web config.
你可以创建一个网络。在每个文件夹内配置适当的安全设置,所有命名为web配置。
- ~/members/web.config
- ~ / / web . config
- ~/members/vip/web.config
- ~ /会员/贵宾/ web . config
like:
如:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<authorization>
<allow roles="developers" />
<allow roles="testers" />
<deny users="*" />
</authorization>
</system.web>
</configuration>
Per folder you can have one original web.config, so it would be a good approach to move resources (handlers, pages, controls) "per-authorazition" to that according folder.
每个文件夹可以有一个原始web。配置,所以这将是一个很好的方法来移动资源(处理程序、页面、控件)根据文件夹的“每授权”。