开发者

Hot to block access to page with defined URL in ASP.NET site on IIS except from one defined IP?

开发者 https://www.devze.com 2023-03-24 06:29 出处:网络
We have ASP.NET web site hosted on IIS. We need to block access to page \"http://www.example.com/sample/page1.aspx\" from any IP.

We have ASP.NET web site hosted on IIS. We need to block access to page "http://www.example.com/sample/page1.aspx" from any IP. We want to define single IP which can access this page.

What option of IIS or Windows can h开发者_如何学Celp me?


If you are using IIS7 + you could use the URL Rewrite Module http://www.iis.net/download/urlrewrite

However if you are using IIS6 you can try a tool like Helicon ISAPI Rewrite http://www.helicontech.com/isapi_rewrite/ which will allow you to write an IP based rule.


Try this in your code behind (although this is not IIS or Windows as you request):

if (Request.UserHostAddress == "1.1.1.1") {  }

Obviously substitute the IP address you want!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号