Blacklist added to Commentor


Some people complain about Akismet not killing spam as effectively as they would like or hope. I think Akismet doing fine job identifying spam bots, but recently a lot of it coming from real people trying to make a little extra money, and those are challenging to deal with. Sometimes I get totally valid comment and the only odd thing about it is that guy’s name is “buy cheap watches” or something like it. It is tough to filter out programmatically. Probably, the best solution for a moment is similar counter-move when people tired of spam come together and create list of known spammers so that spam blocking applications can use it.

One of such sites is and updated version of Commentor (1.3.2) uses its API to check if person trying to add comment to the blog listed in the stopforumspam’s database. If it is, comment will be marked as spam without passing it to Akismet for validation.

New users can install Commentor using instructions from this post. All download links are pointing to the same file. If you already have Commentor installed, you only need to replace extension file – unzip and move “App_Code/Extensions/Commentor.cs” to the corresponding location at your blog.

The change itself is very simple and comes down to this function:

static bool IsBlackListed(string ip)
        string url = string.Format("{0}", ip);
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        StreamReader reader = new StreamReader(response.GetResponseStream());

        string value = reader.ReadToEnd();

        return value.ToLowerInvariant().Contains("yes") ? true : false;
    catch (Exception)
        return false;

Got to love .NET!


This site is all about developing web applications with focus on designing and building open source blogging solutions. Technologies include ASP.NET Core, C#, Angular, JavaScript and more.