Asp.net 仅允许特定IP访问网站

Asp.net 仅允许特定IP访问网站,asp.net,Asp.net,我有一个网站运行在IIS 6.0,该网站是一个asp.net与框架4.0 我们有一个应用程序,它不是托管在客户机上,而是托管在我们这边。客户端要求仅允许访问特定IP 因此,我在web.config中添加了IP列表,如下所示: <security> <ipSecurity allowUnlisted="false"> <clear/> <!-- removes all upstream restrictions --> &

我有一个网站运行在IIS 6.0,该网站是一个asp.net与框架4.0 我们有一个应用程序,它不是托管在客户机上,而是托管在我们这边。客户端要求仅允许访问特定IP

因此,我在web.config中添加了IP列表,如下所示:

<security>
  <ipSecurity allowUnlisted="false">    
    <clear/> <!-- removes all upstream restrictions -->
    <add ipAddress="XXX.XXX.XXX.114" subnetMask="255.255.255.0" allowed="true"/>
<add ipAddress="XXX.XXX.XXX.85" subnetMask="255.255.255.0" allowed="true"/>
   </ipSecurity>
 </security>

在本例中,只有两个IP可以访问该侧。 我需要多做一步吗?因为它不起作用。这是最好的方法吗?
谢谢。

我想你的答案在这个链接中

兼容性
版本说明
IIS 7.5未在IIS 7.5中修改元素。
IIS 7.0该元素是在IIS 7.0中引入的。
IIS 6.0元素替换IIS 6.0 IPSecurity元数据库属性。
    Compatibility

    Version   Notes

IIS 7.5     The <ipSecurity> element was not modified in IIS 7.5.

IIS 7.0     The <ipSecurity> element was introduced in IIS 7.0.

IIS 6.0     The <ipSecurity> element replaces the IIS 6.0 IPSecurity metabase property.