How to Block IP Addresses in web.config

If you want to restrict website access to certain IP address, you have to do it in the web.config file. The Web.config allows you to restrict access to a page, directory, all sub directories, or even the whole website. In this article I will give you a step by step guide on how to blog IP addresses in web.config

1. Open the web.config file of your project.

2. In the web.config file, open a <security> tag. This MUST to be added inside the <system.webServer> tag:

1

3. Inside the <security> tag, add the following lines:

<ipSecurity allowUnlisted=”true”>

Where ‘allowUnlisted‘ means that everybody has access except the IP listed below that line:

2

4. Inside the <ip security> tag, list the IP addresses that you want to block like this:

<add ipAddress=”83.116.19.53″/>

3

5. Save your web.config and that’s it, the IP addresses you want will not be able to access your site or ASP application.

This concludes How to block IP addresses in web.config

Looking for quality ASP Web Hosting? Look no further than Arvixe Web Hosting!

Happy Hosting!

Rodolfo Hernandez

Tags: , , , , , , , , , , , , , , , , , , , , , , | Posted under ASP .NET 2, ASP .NET 3.5, DotNet/Windows Hosting, WebsitePanel Tutorials | RSS 2.0

Author Spotlight

Rodolfo Hernandez

Rodolfo Hernandez

I like photography and reading books. Currently working for Arvixe as Elgg Community Liaison. Elgg Security Expert Web Security Expert CEO of UDP SW Social Web

Leave a Reply

Your email address will not be published. Required fields are marked *


5 − = 3

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>