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!
精彩评论