<?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; ASP.Net</title>
	<atom:link href="http://www.sosuke.com/index.php/category/aspnet/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>Post-mortem report of my free online dating service; Part 2 of 2</title>
		<link>http://www.sosuke.com/index.php/2011/10/08/post-mortem-report-of-my-free-online-dating-service-part-2-of-2/</link>
		<comments>http://www.sosuke.com/index.php/2011/10/08/post-mortem-report-of-my-free-online-dating-service-part-2-of-2/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 21:50:04 +0000</pubDate>
		<dc:creator>sosuke</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Website Analysis]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://www.sosuke.com/?p=106</guid>
		<description><![CDATA[My free online dating site launch in May of 2009 after a little under 2 years of work. Now I just need to get people to come to or write about the site and the real work has begun. I post it up to all the social networks at the time telling people to come [...]]]></description>
			<content:encoded><![CDATA[<p>My free online dating site launch in May of 2009 after a little under 2 years of work. Now I just need to get people to come to or write about the site and the real work has begun. I post it up to all the social networks at the time telling people to come check out my site. &#8220;SPAMMER!&#8221; I hear. Crap, how can I tell you about the site but not tell you about the site?</p>
<p>I thought my solution to organic marketing would be to get other people to write about it. I searched for and made lists of blogs and sites that wrote about online dating or dating in general and started crafting individual emails for each site. For hundreds of sites I found I spent a few hours each night trying to first find a method to contact them via form or email. If I was able to find a contact method I wrote up an email about how awesome my new site was and the work I put into it and they should take a look or write about it. After a few months of this I was completely burnt out. I had gotten next to no responses from all my work, less than 1% feels generous. No one responding to me after the hundreds of communications I sent out was crushing.</p>
<p>I tried a couple of paid per post services but that investment didn&#8217;t pan out. The services themselves were OK, the posts went up pretty quick but the types of sites doing this weren&#8217;t exactly well respected. With all their other pay per posts it was like trying to hold a quiet conversation at a concert. A worthless avenue for marketing.</p>
<p>The only reliable method to get new visitors from day one that I used was online advertising through Google AdSense and Facebook Ads. I setup accounts for both services and right away I was getting click throughs and new members. Everyday I was checking my cost per registration from both services and quickly found Facebook Ads just wasn&#8217;t performing well. With just Google AdSense to focus on I created a dozen campaigns with different keywords targeting states, cities and the different sexes. I spent a good amount of money here and it was extremely addictive. I would not recommend pay per click campaigns for anyone without extremely deep pockets or free services to use. Without this service I would not have gotten any users and with it I ended up hating the project more and more. I was spending money everyday and making a little money but it was never increasing over time.</p>
<p>One of my biggest mistakes was not developing a proper site administration system. I underestimated the amount of profile removals I would need to make per day. I spent about 30-45 minutes on some days just cleaning up bad profiles. I finally setup a rudimentary system but even then I sometimes had to resort to my set of SQL scripts to do some tasks.</p>
<p>My largest problem I never resolved was spam. The only people that actually wanted to seek out and use my site were spammers. Mostly from Nigeria and it&#8217;s surrounding countries but also from Russia for mail order brides. I had ReCAPTCHA in place but they didn&#8217;t care. These weren&#8217;t robots I was keeping out but tons of people that sent out hundreds of messages a day. My final attempt was a manual message and user approval process. That meant that before any new users messages were sent I had to approve them. This was just too much work and something I never considered before launching but could never solve afterwards. They ruined the site for me and the legit users that signed up.</p>
<p>I&#8217;m going to shut down the service this year and will be open sourcing my code, I need to clean out any S3 key stuff. There was a lot of important lessons I learned during this experience. My product didn&#8217;t have an interesting angle. I didn&#8217;t solve any new problems or solve an existing problem so well people wanted to talk about it. My marketing was underbudget to compete against the larger players. I under developed my application and failed to think through the spam factors.</p>
<p>I&#8217;m happy to have done the project but I&#8217;d be lying to say I&#8217;m not even happier to have it in the past.</p>
<p>Check out <a title="Post-mortem report of my free online dating service; Part 1 of 2" href="http://www.sosuke.com/index.php/2011/02/07/post-mortem-report-of-my-free-online-dating-service-part-1/">Post-mortem report of my free online dating service; Part 1 of 2</a> if you didn&#8217;t see the ramp up to launch</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sosuke.com/index.php/2011/10/08/post-mortem-report-of-my-free-online-dating-service-part-2-of-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Post-mortem report of my free online dating service; Part 1 of 2</title>
		<link>http://www.sosuke.com/index.php/2011/02/07/post-mortem-report-of-my-free-online-dating-service-part-1/</link>
		<comments>http://www.sosuke.com/index.php/2011/02/07/post-mortem-report-of-my-free-online-dating-service-part-1/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 14:11:17 +0000</pubDate>
		<dc:creator>sosuke</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Website Analysis]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://www.sosuke.com/?p=87</guid>
		<description><![CDATA[I registered the domain for my free online dating service, DiveIntoThePool.com, in October of 2007. I decided that along with making my first real startup that I would invest money in that it would be a good idea to do in a language I didn&#8217;t already know (ASP.NET), with a database I wasn&#8217;t familiar with [...]]]></description>
			<content:encoded><![CDATA[<p>I registered the domain for my free online dating service, DiveIntoThePool.com, in October of 2007. I decided that along with making my first real startup that I would invest money in that it would be a good idea to do in a language I didn&#8217;t already know (ASP.NET), with a database I wasn&#8217;t familiar with (MSSQL) and on a platform I had not deployed anything on before (IIS6).  My thinking was that along with creating this sure fire website that I could make money though advertising off of I would try and learn as many things along the way as possible. I worked on this project in my evening times while also supporting a medium-core World of Warcraft habit. When I say something took days of research it&#8217;s real time passed after work, WoW and a little life.</p>
<p>I had modest goals to measure the success of the site. My first goal after launching was to make more money than I spent in hosting and advertising. After that I wanted to invest all actual profits back into the site so it would continue to grow. I pictured a power point graphic of exponential growth and with a little patience I would be rich!</p>
<p>I broke the site down into smaller and smaller chunks and for every small milestone or functionality I completed I patted myself on the back. Milestones such as getting Visual Studio Web Express to pre-compile DLLs so I didn&#8217;t have to place source files on my webserver, which I had none setup at the time, or migrating my new found <a href="../index.php/2009/05/30/free-us-zip-code-database/">zip code database</a> from MySQL to MSSQL. Every step I took involved several days of thinking and research.</p>
<p>I swear it wasn&#8217;t intentional but I felt like I put as many technical obstacles in between myself and launching the site as possible. I vividly remember spending several evenings, days I felt like, trying to decide on which source control solution I should use. I kept hearing Git this and Git that at the time but it took me a while still to figure out there was no easy way to run a Git server on my home Windows machine. I finally settled into VisualSVN and celebrated when I checked a file in from my laptop and got latest from my desktop! I was on my way.</p>
<p>I stressed over membership and security for a long time as well. Don&#8217;t store passwords in plain text, watch out for all user input and SQL injection worries. I had created a pretty full registration and login web of pages before I even thought about creating a admin interface for my users. That&#8217;s no problem I thought at first, Visual Studio Web Express came with this very helpful ASP.NET Web Site Administration Tool that I found out, after several more nights, couldn&#8217;t be installed remotely on my newly acquired shared hosting environment. Screw it! At that point I had a text file of SQL scripts I was running to do development work that ended up being my &#8220;admin&#8221; interface to the site.</p>
<p>I had been using my free time since registering the domain working on the site and learning C# but by December 2008 I still seemed far away from launching anything I was proud of. I was doubting my plans and if I didn&#8217;t do something drastic soon I would never launch the site. In January 2009 I quit playing World of Warcraft, I disbanded the guild I had put together, transferred onto another server and kept no ties to anyone I knew. Even my real life friends didn&#8217;t know where my characters went. Shortly there after I actually canceled my accounts. Suddenly I had all the time in the world during my evenings to work.</p>
<p>Within 5 months of cutting out video games I was able to launch the site in May of 2009. I actually did a soft launch first, running through all of my test cases a few times just to check for any obvious bugs. All of my testing, research, learning and code was live. It took me far to long to get here I told myself and I knew that the hardest hurdles were still to come. No one knows me, I have no track record of success, how on Earth am I going to get people to sign up or even visit my freshly unwrapped free online dating service.</p>
<p>Continued in <a href="http://www.sosuke.com/index.php/2011/10/08/post-mortem-report-of-my-free-online-dating-service-part-2-of-2/">Post-mortem report of my free online dating service; Part 2 of 2</a> to read about the end of DiveIntoThePool</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sosuke.com/index.php/2011/02/07/post-mortem-report-of-my-free-online-dating-service-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>

