我已经创建了新的ASP.NET网站。我正在Visual Studio中编辑(Open WebSite和通过FTP)。我想阻止所有人查看网站,除了我的IP地址。只允许一个IP可以访问ASP.NET网站
在PHP中我是这样做在.htaccess这样的:
RewriteEngine On
RewriteBase/
RewriteCond %{REMOTE_ADDR} !^XX\.XXX\.XXX\.XX$ //my IP
RewriteCond %{REQUEST_URI} !^/construct
RewriteRule (.*) /construct/index.php [R=307,L] //redirect when other IP access website
在ASP.NET我只找到这一解决方案(在Web.config中):
<?xml version="1.0"?>
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
<system.webServer>
<security>
<ipSecurity allowUnlisted="false">
<clear/>
<add ipAddress="XXX.XXX.X.X" allowed="true"/>
</ipSecurity>
</security>
</system.webServer>
</configuration>
但是这并未不适合我。当我在写入这个页面后输入页面时,它给了我以下错误:
服务请求时出错。 服务器没有返回任何可以显示的网站。 问题的可能原因是在生成此网页的脚本中。
什么问题或者我该怎么解决这个问题?
您的应用程序是asp.net还是php? –
你有没有在服务器上看过[这个清单](http://www.iis.net/configreference/system.webserver/security/ipsecurity)?假设你有,你可以验证你的客户端(你的机器)使用的IP是否与你配置的限制匹配? – EdSF
在asp.net中,它并不在我自己的服务器上运行,但我已付费托管,因此无法配置服务器。 – BblackK