Go Back

Deleting Sitefinity Blog Comment SPAM

Terry presents his Internet Marketing Idea Robert quickly entered the conference room as everyone waited expectedly.  Sales had been down for 3 months in a row and rumors foretold the sh*t was about to hit the fan.

“Listen people” Robert began “we’ve had a few rough months.”

The words had the same impact as a cinder block being dropped onto the conference table.  Robert paused and dramatically let his gaze wander from person to person.  Without saying it, he was incriminating everyone and assigning each their portion of the blame.

Robert then let the hammer fall, “What I’m looking for, from each of you, are solutions!  How do we turn this ship around?”

The question was met with silence.  Everyone looked like a deer caught in the headlights.

Robert paused, but then pressed on. “Terry, you’re marketing, how do we raise awareness of our products?”

Terry cleared his throat and began sputtering nonsense in an attempt to buy some time.  Robert’s brow furrowed in frustration.  Suddenly, Terry shouted “Blogging” with the same enthusiasm as a child discovering their first curse word.

Silence fell across the conference table.  Somewhere Robert had heard this word.  Perhaps in an airplane magazine.  He was intrigued and flatly said “Explain”.

Basking in this new found attention, Terry was gathering courage and momentum by the second.

“It’s an Internet thing”, Terry explained.  “Blogging is huge and we can make Web 2.0 SEO with blogging and Twitter.”

Robert was having trouble parsing that sentence, but he was already sold.  For months, he had encouraged everyone to “think outside the box”.  Terry’s innovative thinking was exactly what the company needed. 

Terry was given the floor and he energetically detailed his new Internet marketing plan…

South Park's Underpant's Gnomes Phased Plans

You’ve Got New Blog Comments!

Yesterday, Joseph Anderson gave me a heads up that one of my blog posts had 800+ blog comments.  Almost all of these comments looked like this:

Blog Comment SPAM in Sitefinity

Yes, I know I should’ve been using CAPTCHA.  It’s been on my to-do list for awhile.  I just hadn’t gotten around to it. 

I wasn’t looking forward to manually removing all of this SPAM using the Sitefinity Admin.  However, as I looked at the offending comments I noticed a trend.

Blog Comment SPAM in Sitefinity's Admin

These SPAM comments were all coming from the same IP address.  I wondered if I could use the Sitefinity API to quickly nuke these comments.

Removing Blog SPAM en masse using Sitefinity’s API

To remove all of these blog SPAM comments, I created a quick ASPX page in the root of my Sitefinity web site.  Here is the code:

~/DeleteSpam.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DeleteSpam.aspx.cs" Inherits="DeleteSpam" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Nothing to see here.
</div>
</form>
</body>
</html>

~/DeleteSpam.aspx.cs

using System;
using System.Collections;
using Telerik.Cms.Engine;

public partial class DeleteSpam : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Telerik.Cms.Engine.ContentManager contentManager = new Telerik.Cms.Engine.ContentManager("Blogs");
IList comments = contentManager.GetComments("author asc", "IpAddress:91.207.5.138");

foreach (IComment comment in comments)
{
contentManager.DeleteComment(comment.ID);
}
}
}

Once this ASPX page was created I just requested it in my browser.  When it was finished loading I removed the DeleteSpam.aspx page from my Sitefinity web site.

After I removed all of the SPAM comments from this IP address, I then discovered many more SPAM comments.  This additional SPAM was using a URL as the author.  To remove these SPAM comments I used the following code:

using System;
using System.Collections;
using Telerik.Cms.Engine;

public partial class DeleteSpam : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Telerik.Cms.Engine.ContentManager contentManager = new Telerik.Cms.Engine.ContentManager("Blogs");
IList comments = contentManager.GetComments("author asc", "Author:http%");

foreach (IComment comment in comments)
{
contentManager.DeleteComment(comment.ID);
}
}
}

If you’re interested in getting more information about fetching & filtering comments, please see the Finding Comments page in the Sitefinity manual.

Comments  3

  • Gabe Sumner 19 Jun

    I discovered most of the SPAM is coming through Trackback.  Sadly I have now had to disable this feature for Sitefinity Watch.  
  • tim 10 Sep

    I like to spend much time in the Internet, but, unfortunately not often find something worthy and interesting to read. I liked the way you covered the topic and depth with which you explain these important things.

    I'd like to recommend my torrents search engine http://torrents.rapid4me.com . Hope you will like it.

  • Jeff 04 Nov

    Oh the irony- a blog post about battling blog comment spam filled with blog comment spam.
Post a comment!
  1. Formatting options
       
     
     
     
     
       
  2. I'm sorry for the CAPTCHA. You have spammers to thank for this: