IIS - Block country IP addresses - Asked By Ian Potts on 08-Oct-10 07:17 AM

I have a client that would like to block all traffic from a country (Germany). (The want to block German traffic as prices are different in Germany).
I have a list of German IP addresses, and can add them in one by one through IP and Domain Restrictions module.
But it would be quicker if I could add/amend a file. Does anyone know where to the file is located?

Thanks
Ian
Anurag replied to Ian Potts on 08-Oct-10 07:49 AM
U can use ISAPI for this and it doesnt comes free, check these links:
http://www.ip2location.com/ip2location-isapi-filter.aspx
http://www.countryipblocks.net/country-blocks/
http://www.hdgreetings.com/other/Block-IP-IIS

Also go to these links, will help u:
http://www.west-wind.com/WebLog/posts/59731.aspx
http://webhosting.bigresource.com/Blocking-Entire-Countries-in-IIS-yw5Z0gfn.html
http://www.sosuke.com/index.php/2009/05/20/blocking-ip-addresses-by-country-on-iis-shared-hosting/

Ian Potts replied to Anurag on 08-Oct-10 08:14 AM
Sorry, should have said, the server uses IIS7
Lalit M replied to Ian Potts on 09-Oct-10 05:47 AM
You can Block Country and IP Addresses in ASP.NET using HTTPModule.

1) Rule is if the IP address is in denied list or ip address is not in granted list it will be blocked. Also, IP address will be checked against all the defined blocking scheme in the configuration until ip is blocked. If the IP is granted access and not in blocked list IP address will be granted.

2) IP Address can contain * as wild character.
i.e. <ip value="127.0.0.1" access="granted" valueType="IpAddress" />

3) Range of IP address can be specified.
i.e. <ip value="127.0.0.1;127.0.0.200" access="denied" valueType="IpRange" />

4) Can block country.
i.e. <ip value="IN;US" access="denied" valueType="CountryCode" />

5) Multiple IP address blocking scheme can be defined.
i.e. grant all ip from 127.0.0.1 through 127.0.0.255 EXCEPT 127.0.0.20 through 127.0.0.25.
<ip value="127.0.0.*" access="granted" valueType="IpAddress" />
<ip value="127.0.0.20;127.0.0.25" access="denied" valueType="IpRange" />
you will get source code and step by step details here
undhad ashwin replied to Ian Potts on 20-Oct-10 05:04 PM
Please Used Below Link  because used below link and block all traffic from a country

http://www.west-wind.com/weblog/posts/59731.aspx