在Asp.NET中是否有办法通过检查IP地址来限制来自某个国家/地区的访问。到目前为止,我更改了web.config文件。我从第三方API收集ip地址。但是它给出了我附加屏幕截图的错误。
任何帮助都会很棒。提前致谢
这是我的webconfig;
<system.webServer>
<security>
<ipSecurity allowUnlisted="true">
<clear/>
<add ipAddress="5.2.80.0" subnetMask="255.255.248.0"/>
<add ipAddress="5.10.140.0" subnetMask="255.255.255.0"/>
<add ipAddress="5.11.128.0" subnetMask="255.255.128.0"/>
<add ipAddress="5.23.0.0" subnetMask="255.255.255.0"/>
<add ipAddress="5.23.16.0" subnetMask="255.255.255.248"/>
<add ipAddress="5.23.120.0" subnetMask="255.255.248.0"/>
<add ipAddress="5.24.0.0" subnetMask="255.252.0.0"/>
<add ipAddress="5.44.80.0" subnetMask="255.255.240.0"/>
<add ipAddress="5.44.144.0" subnetMask="255.255.240.0"/>
<add ipAddress="5.46.0.0" subnetMask="255.254.0.0"/>
<add ipAddress="5.62.126.0" subnetMask="255.255.254.0"/>
<add ipAddress="5.63.32.0" subnetMask="255.255.224.0"/>
<add ipAddress="5.104.0.0" subnetMask="255.255.240.0"/>
<add ipAddress="5.159.248.0" subnetMask="255.255.248.0"/>
<add ipAddress="5.176.0.0" subnetMask="255.254.0.0"/>
<add ipAddress="5.226.192.0" subnetMask="255.255.192.0"/>
<add ipAddress="5.229.0.0" subnetMask="255.255.0.0"/>
<add ipAddress="5.250.240.0" subnetMask="255.255.240.0"/>
<add ipAddress="5.255.0.0" subnetMask="255.255.192.0"/>
<add ipAddress="23.229.3.0" subnetMask="255.255.255.0"/>
<!-- ...
...
...
... -->
</ipSecurity>
</security>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
在这里结果
答案 0 :(得分:0)
从this article开始,问题似乎与服务提供商将安全设置锁定在更高级别并阻止覆盖有关。
该部分被锁定在更高级别,例如applicationhost.config
以下是有关如何锁定这些设置的页面链接:http://www.iis.net/learn/get-started/planning-for-security/how-to-use-locking-in-iis-configuration