我正在使用ASP提供程序,并使用名称服务器将基于IIS的ASP域指向防火墙提供程序。防火墙提供商建议,假设我使用的是Apache,请通过编辑.htaccess文件来禁用绕过Web.Config安全设置的尝试。但是,ASP使用IIS。我确实注意到,对于Apache,您只需要使用以下代码修改.htaccess:
<FilesMatch ".*">
Require ip XXX.XX.XXX.X/23
Require ip YYY.YY.YYY.Y/22
(MORE IP ADDRESS)
</FilesMatch>
UPDATE
您可以使用IIS管理器或Web.Config来设置基于IP地址的访问控制。最初,我使用IIS管理器来设置IP地址访问权限,但现在只想使用以下文件内容转换为Web.Config:
<configuration>
<system.webServer>
<httpRedirect enabled="true" destination="https://www.myweb.org/" />
<directoryBrowse enabled="true" />
<security>
<ipSecurity allowUnlisted="false">
<clear/>
<add ipAddress="127.0.0.1" allowed="true"/>
<add ipAddress="11.111.111.11" allowed="true"/>
<add ipAddress="222.22.22.22" allowed="true"/>
</ipSecurity>
</security>
</system.webServer>
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;"/>
</appSettings>
<location path="Default WebSite">
</location>
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
</system.web>
<system.codedom>
</system.codedom>
<startup>
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
当我使用VPN然后使用固定的IP地址访问站点时,访问控制现在看起来似乎有点前后不一致。有时我会收到403错误,但没有收到,其他时候屏幕只是白色。这可能是因为未清除IIS管理器中的某些设置,所以我有以下问题:
是否有一种方法可以在每次访问后重置(归零)IP访问控制设置在IIS管理器中是否删除了“条目” IP地址?
当使用Web.Config进行IP访问控制时,是否需要打开IIS管理器并指定->编辑功能设置->允许(未指定客户端的访问)?
我是否需要在Web.Config中的某个位置拒绝?
当Web.Config和IIS管理器具有列出的用于访问控制的相同IP地址(我认为会导致冲突)时,会发生什么?