<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sosuke &#187; C#</title>
	<atom:link href="http://www.sosuke.com/index.php/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sosuke.com</link>
	<description>Dark music of the gods.</description>
	<lastBuildDate>Tue, 15 Nov 2011 04:52:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Blocking IP addresses by country on IIS shared hosting</title>
		<link>http://www.sosuke.com/index.php/2009/05/20/blocking-ip-addresses-by-country-on-iis-shared-hosting/</link>
		<comments>http://www.sosuke.com/index.php/2009/05/20/blocking-ip-addresses-by-country-on-iis-shared-hosting/#comments</comments>
		<pubDate>Thu, 21 May 2009 06:23:08 +0000</pubDate>
		<dc:creator>sosuke</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[shared hosting]]></category>

		<guid isPermaLink="false">http://www.sosuke.com/?p=32</guid>
		<description><![CDATA[On a shared hosting environment you often won&#8217;t have access to ban IP addresses on the IIS level and my shared host didn&#8217;t offer the Firewall module for Plesk so I had to come up with a programmatic way of blocking large blocks of IPs. You can setup in your web.config file something called a [...]]]></description>
			<content:encoded><![CDATA[<p>On a shared hosting environment you often won&#8217;t have access to ban IP addresses on the IIS level and my shared host didn&#8217;t offer the Firewall module for Plesk so I had to come up with a programmatic way of blocking large blocks of IPs. You can setup in your web.config file something called a HTTPModule that works before the page is delivered to the client computer. For this sample I added a key and value to my web.config file that holds my comma separated IP list that I want to block. Since I&#8217;m running a site that is focused on the United States there isn&#8217;t much overlap on the /24 block area 255.255.255.* so I am only checking the first 3 digit blocks for matches. When a request comes in IpTwentyFourBlockingModule will check the users IP address against the key value blockiptwentyfour to see if there is a match and if it is a match will return 403 forbidden to the client browser, banned! </p>
<p>Coming up with a IP list is another problem. I found <a href="http://iplocationtools.com">IP Location Tools</a> that gives out an API that generates a updated <a href="http://iplocationtools.com/ip_country_block_iptables.php">list of IPs for a given country</a>. The problem is the list gets broken out into IP blocks other than /24, you&#8217;ll see all ranges of IP blocks that get very complicated very fast and more than I wanted to try and pull off in a days work. I wrote a Flash ActionScript 3 application to consume this data and give me a list of unique IPs 255.255.255 that I could then drop in as the value for blockiptwentyfour. I then added IP tracking for new users and have had to ban some rogue /24 blocks that escaped this list but its kept them at bay and more manageable for now. I&#8217;ve already had a colleague suggest that this is still only a stopgap at best and I should develop some kind of throttling system to help prevent spam when I&#8217;m not around to watch the site like a hawk.</p>
<p>web.config</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appSettings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;add</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;blockiptwentyfour&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;41.210.29,41.210.28&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/appSettings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;system.web<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;httpModules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;add</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;IpTwentyFourBlockingModule&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;IpTwentyFourBlockingModule&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/httpModules<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/system.web<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configuration<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>IpTwentyFourBlockingModule.cs &#8211; put this is in your App_Code</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080;">#region Using</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Web</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Configuration</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Collections.Specialized</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080;">#endregion</span>
&nbsp;
<span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
<span style="color: #008080; font-style: italic;">/// Block the response to certain IP addresses</span>
<span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> IpTwentyFourBlockingModule <span style="color: #008000;">:</span> IHttpModule
<span style="color: #008000;">&#123;</span>
&nbsp;
    <span style="color: #008080;">#region IHttpModule Members</span>
&nbsp;
    <span style="color: #6666cc; font-weight: bold;">void</span> IHttpModule<span style="color: #008000;">.</span><span style="color: #0000FF;">Dispose</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #008080; font-style: italic;">// Nothing to dispose; </span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #6666cc; font-weight: bold;">void</span> IHttpModule<span style="color: #008000;">.</span><span style="color: #0000FF;">Init</span><span style="color: #008000;">&#40;</span>HttpApplication context<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        context<span style="color: #008000;">.</span><span style="color: #0000FF;">BeginRequest</span> <span style="color: #008000;">+=</span> <span style="color: #008000;">new</span> EventHandler<span style="color: #008000;">&#40;</span>context_BeginRequest<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #008080;">#endregion</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
    <span style="color: #008080; font-style: italic;">/// Checks the requesting IP address in the collection</span>
    <span style="color: #008080; font-style: italic;">/// and block the response if it's on the list.</span>
    <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">void</span> context_BeginRequest<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> sender, EventArgs e<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #6666cc; font-weight: bold;">string</span> ip <span style="color: #008000;">=</span> HttpContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Request</span><span style="color: #008000;">.</span><span style="color: #0000FF;">UserHostAddress</span><span style="color: #008000;">;</span>
        <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> tempIpArray <span style="color: #008000;">=</span> ip<span style="color: #008000;">.</span><span style="color: #0000FF;">Split</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">'.'</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #6666cc; font-weight: bold;">string</span> iptwentyfour <span style="color: #008000;">=</span> tempIpArray<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;.&quot;</span> <span style="color: #008000;">+</span> tempIpArray<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;.&quot;</span> <span style="color: #008000;">+</span> tempIpArray<span style="color: #008000;">&#91;</span><span style="color: #FF0000;">2</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>_IpAdresses<span style="color: #008000;">.</span><span style="color: #0000FF;">Contains</span><span style="color: #008000;">&#40;</span>iptwentyfour<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            HttpContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Response</span><span style="color: #008000;">.</span><span style="color: #0000FF;">StatusCode</span> <span style="color: #008000;">=</span> <span style="color: #FF0000;">403</span><span style="color: #008000;">;</span>
            HttpContext<span style="color: #008000;">.</span><span style="color: #0000FF;">Current</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Response</span><span style="color: #008000;">.</span><span style="color: #0000FF;">End</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> StringCollection _IpAdresses <span style="color: #008000;">=</span> FillBlockedIps<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">/// &lt;summary&gt;</span>
    <span style="color: #008080; font-style: italic;">/// Retrieves the IP addresses from the web.config</span>
    <span style="color: #008080; font-style: italic;">/// and adds them to a StringCollection.</span>
    <span style="color: #008080; font-style: italic;">/// &lt;/summary&gt;</span>
    <span style="color: #008080; font-style: italic;">/// &lt;returns&gt;A StringCollection of IP addresses.&lt;/returns&gt;</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> StringCollection FillBlockedIps<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        StringCollection col <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> StringCollection<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #6666cc; font-weight: bold;">string</span> raw <span style="color: #008000;">=</span> ConfigurationManager<span style="color: #008000;">.</span><span style="color: #0000FF;">AppSettings</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Get</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;blockiptwentyfour&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> ip <span style="color: #0600FF; font-weight: bold;">in</span> raw<span style="color: #008000;">.</span><span style="color: #0000FF;">Split</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">','</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            col<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>ip<span style="color: #008000;">.</span><span style="color: #0000FF;">Trim</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">return</span> col<span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>collectipaddresses.as</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
</pre></td><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span><span style="color: #000066; font-weight: bold;">.*;</span>
<span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.net</span><span style="color: #000066; font-weight: bold;">.*;</span>
&nbsp;
<span style="color: #6699cc; font-weight: bold;">var</span> myRequest<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">URLRequest</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLRequest</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;http://iplocationtools.com/country_query.php?country=CI,SN,GH,NA,NG&quot;</span><span style="color: #000000;">&#41;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">loader</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">URLLoader</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">URLLoader</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #004993;">loader</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">dataFormat</span> = <span style="color: #004993;">URLLoaderDataFormat</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">TEXT</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #004993;">loader</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">COMPLETE</span><span style="color: #000066; font-weight: bold;">,</span> handleComplete<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #004993;">loader</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">load</span><span style="color: #000000;">&#40;</span>myRequest<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> handleComplete<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">loader</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">URLLoader</span> = <span style="color: #004993;">URLLoader</span><span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">target</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #009900; font-style: italic;">//trace(loader.data.replace(/\n/g, &quot;|&quot;));</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> ipArray<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #004993;">loader</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">data</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">replace</span><span style="color: #000000;">&#40;</span><span style="color: #009966; font-style: italic;">/\n/g</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #990000;">&quot;|&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">split</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;|&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>ipArray<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	setTwentyFourBlock<span style="color: #000000;">&#40;</span>ipArray<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> setTwentyFourBlock<span style="color: #000000;">&#40;</span>ipArray<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Array</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #6699cc; font-weight: bold;">var</span>	shortIpArray<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #6699cc; font-weight: bold;">var</span>	lastUniqueIp<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #0033ff; font-weight: bold;">each</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> ip<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> <span style="color: #0033ff; font-weight: bold;">in</span> ipArray<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #6699cc; font-weight: bold;">var</span> tempIpArray<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = ip<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">split</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #6699cc; font-weight: bold;">var</span> stringCurrentIp<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = tempIpArray<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot;.&quot;</span><span style="color: #000066; font-weight: bold;">+</span>tempIpArray<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot;.&quot;</span><span style="color: #000066; font-weight: bold;">+</span>tempIpArray<span style="color: #000000;">&#91;</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">+</span><span style="color: #990000;">&quot;.0&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>stringCurrentIp <span style="color: #000066; font-weight: bold;">!</span>= lastUniqueIp<span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			lastUniqueIp = stringCurrentIp<span style="color: #000066; font-weight: bold;">;</span>
			shortIpArray<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>stringCurrentIp<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>shortIpArray<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">length</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>shortIpArray<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">join</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">','</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>All of this work has really kept my <a href="http://www.diveintothepool.com/">free online dating</a> site almost spam free for now but I&#8217;m adding IP blocks I&#8217;ve missed from time to time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sosuke.com/index.php/2009/05/20/blocking-ip-addresses-by-country-on-iis-shared-hosting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

