【发布时间】:2015-01-09 06:29:26
【问题描述】:
如何为多个位置添加多个规则
我有一个 MVC 应用程序我在 Web.Config 中添加了以下部分:
<system.webServer>
<security>
<ipSecurity allowUnlisted="false">
<clear />
<add ipAddress="127.0.0.1" allowed="true" />
<add ipAddress="41.111.32.153" allowed="true" />
</ipSecurity>
</security>
<system.webServer>
现在我想添加另一个安全规则以允许某些 ips 仅访问主页,我尝试在基础项下添加此部分,例如:
<location path="Home">
<system.webServer>
<security>
<ipSecurity allowUnlisted="false">
<clear />
<add ipAddress="44.244.6.162" allowed="true" />
<add ipAddress="44.244.6.163" allowed="true" />
</ipSecurity>
</security>
</system.webServer>
</location>
我也试过<location path="Home" allowOverride="true">,但效果不佳!
你能告诉我我应该写什么来和我一起工作吗?
【问题讨论】:
-
this question的可能重复
标签: asp.net asp.net-mvc security web-config