Access to be able to edit the Global.asax file. We need to place some code in the routine that fires when the web application starts up as well as intercept each request being made to the website.
A plain text editor to create and maintain the XML file that contains the IP addresses.
Sample XML Block File
Place the code of the two functions directly into the code section of the Global.ashx file or (preferably) create a seperate class for the IP Blocker.
In the section Application_BeginRequest place the code as shown below
Each request to the website is first passed through the 'Application_BeginRequest' method. Here we detect the IP address of the visitor and ask the IpIsBlocked function if it may go through or should be rejected.
Using regular expressions the IP address is first checked to ensure it conforms to the requirements of an IP number structure, else it will return with a false positive to allow the 'IP address'.
The first call to the website will initiate the loading of the data in the XML file into a memory cached dataset, for fast access. Should a complete xxx.xxx.xxx.xxx IP address be received, it will query the data table for its existence. If found, the return instruction to block the IP is set to true. A 403 HTTP response code is returned informing the visitor that they not authorized to continue and the connection is dropped.
An actual +/- 48 hours overview of IP addresses that are blocked, including a searchable database can be found on the Cyber Security page.
2015 banned and blockedIP address data listings
2015 - Blocked IP addresses
2014 banned and blocked IP address data listings
2014 - Blocked IP addresses
2014 - Spam IP addresses
2014 - Unwelcome robots IP addresses
Place the required library references in the header of 'Global.ashx' or the Class you place the code in.
The two routines IpIsBlocked and IsValidIP below are all you need to get the IP Address filter running
Links to IP Lists we use to block and throttle access to various websites and services. You are welcome to use these as you please, but please do not automate against these list unless you want your IP listed here to.
Note: As of July 2013 the ISA listings are no longer updated nor maintained. The lists above are based on actual TMG IP Intercepts.