.NET and Open Source: better together


  • Join Us on Facebook!
  • Follow Us on Twitter!
  • LinkedIn
  • Subcribe to Our RSS Feed

Commentor – new version

ctor-4 After using Commentor for almost three month now, I’m refreshing it with new version based on users feedback and my own experience. It saved me a lot of time so far catching almost 200 spam comments that I would have to remove manually otherwise. Even though I’m very satisfied with how it works, I hope new and improved version will be much better. Here is some of the key features that has been added or changed.

1. There is no more separate XML file to hold spam messages, Commentor will use BE moderation feature and act as automated moderator approving messages that passed validation. This allows to show/edit both approved and unapproved comments, so that you only need to look at one place. You can select between all/approved/unapproved to see only relevant comments.

2. I found that most of the time I can easily identify number of messages dropped by spam robot and “approve/delete all” option is not very useful, it has been replaced with “approve/delete selection” which is much more convenient in many cases.

3. Comment counters added to the row and to the footer.


4. Configuration moved to its own tab so that it does not get into the way every time you want just to look at latest comments.

5. Manual filter added to extension and now you can filter comments based on IP, name or content. If comment was blocked or approved by filter, Commentor will not make a call to the anti-spam service. You can use filter even without enabling such a service, although I would highly recommend to use one based on my experience with Waegis which is really great.


6. Edit comment pop-up dialog now let you approve/delete comment right from there saving time and clicks.


7. Spam counter control improved to work with both Waegis and Akismet, it’ll check which service you get enabled and show stats for this service only.


To install

1. Copy (FTP) files to your server
2. Enable comment moderation in admin/settings
3. Configure extension (admin->commentor edit->configuration)
4. Optionally, add spam counter control to your theme:

<%@ Register TagPrefix="cnt" TagName="SpamCounter" src="~/User controls/Commentor/SpamCounter.ascx" %> 
<cnt:SpamCounter ID="spamCounter" runat="server" /> 

Upgrade from previous version

1. Approve/delete all comments in the Commentor
2. If you are using spam counter control, remove it from your theme. You'll need to remove these lines:

<%@ Register TagPrefix="pbw" TagName="PoweredByWaegis" src="~/User controls/Commentor/PoweredByWaegis.ascx" %> 
<pbw:PoweredByWaegis ID="poweredByWaegis" runat="server" /> 

3. Delete ~/user controls/commentor folder, ~/app_code/commentor.cs and ~/app_data/datastore/extensions/commentor.xml 
4. Update spam counter; open /App_Code/Extensions/Commentor.cs and update it with your values (change nubmer from "0" to whatever your count is)

settings.AddValue("WaegisApproved", 0); 
settings.AddValue("WaegisRejected", 0); 

5. Restart IIS (log to the site and make sure Commentor gone)

Install new extension as described above.

Commentor.zip (30.961 kb)

Comments (29) -

  • Juan Manuel

    2/16/2009 11:25:23 PM |

    Excellent, I'm sick and tired of Busby... I remembered this extension today, came to download it, and found this new version.


  • Krishnan

    2/17/2009 4:54:26 AM |

    When i opened admin i got the following error

    Input string was not in a correct format.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.FormatException: Input string was not in a correct format.

    Source Error:

    Line 37:
    Line 38:         _settings = ExtensionManager.GetSettings("Commentor");
    Line 39:         gridComments.PageSize = int.Parse(_settings.GetSingleValue("CommentsPerPage"));
    Line 40:
    Line 41:         if (!Page.IsPostBack)

  • rtur.net

    2/17/2009 5:57:44 AM |

    Krishnan, looks like settings object was not reset/created properly. In happens in some environments based on setup of IIS and and other things that usually out of our hands. The easiest way to fix it to "jump-start" setting object. Copy "InitSettings()" function from commentor extension to the "admin.aspx.cs" and call it just before where it is failing like this:
    if(_settings == null) InitSettings();

    This will create default settings and error should go away.

    • Test

      2/23/2009 2:30:07 PM |

      Testing nested comment

  • Dave Burke

    2/18/2009 4:29:15 AM |

    This is excellent.  Thank you!  I've been using Chris' Comment Blacklist extension and it works great, but the updated Commentor is going to save me quality time managing my comments.  I really appreciate all of the great work you do with BlogEngine.NET.  

  • Chris

    2/18/2009 9:53:02 AM |

    Sigh, yet again I have become obsolete...  seriously though, nice job!

  • Paul | Meeting rooms

    2/18/2009 9:11:02 PM |

    I do agree with Juan, Fade up with Busby - Good to see this tool and hopes it really does take away the pain of manually doing it.Nice post.

  • PoiSoN

    3/1/2009 6:35:05 AM |


    Thanks for the new version!
    But I couldn't figure out how to block all comments without using Weiges or Askimet?

    If I select "None", it approves automatically all comments. In previous version "None" blocked all comments, until I approve it manually.

    • rtur.net

      3/1/2009 10:49:50 AM |

      You have to use "Moderate comments" option in general BE.net settings page, it will block all comments by default. Then you use any option in commentor that fit your needs, including manual moderation.

  • Kevin Cornwell

    3/25/2009 4:50:56 AM |

    Nice work.

    This mod needs to be integrated into the distro.

  • Michael Baird

    3/26/2009 5:14:27 AM |

    Excellent, Yeah getting SPAMMED with all the SEO Comment Spammers isn't fun. I will definitely give it a whirl. Hopefully this can be added in to the 1.5 release. :)

  • Mathias

    4/4/2009 3:04:18 PM |

    Just wanted to say - THANK YOU. The lack of comment management capabilities in Blogengine.Net has been frustrating me a lot, and it is in my opinion one of its biggest weaknesses. Not any more!

  • seminyak villas

    4/13/2009 1:40:35 AM |

    It really works and easy way to remove spam messages.thanks for sharing and keep updating.

  • Cheap DVDs

    4/20/2009 8:36:46 AM |

    Thanks you - anything that helps in managing comments has to be useful!  I'll certainly give it a go.  Thanks for sharing!

  • marco

    4/23/2009 7:05:47 AM |

    i have problem to reset statistic ,
    settings.AddValue("WaegisApproved", 0);
    settings.AddValue("WaegisRejected", 0);

    not understand


  • marco

    4/23/2009 9:09:39 AM |



  • rolex replica

    4/29/2009 6:04:17 AM |

    Nice work mate , really happy about the new release hope it gets more popular.

  • unibet

    5/1/2009 2:01:11 AM |

    Many thanks for this really useful post.

  • Al Bsharah

    5/2/2009 12:41:07 PM |

    Ah, now I know why comments were closed on the other post!  <grin>  

    I'm a bit confused though...at the bottom of the configuration page, it says this:
    Waegis: approved 12 blocked 21

    Now...I've selected all of them and "Approved Selected".  They all still remain.  I'm assuming this is normal behavior, but am confused as to the 12 approved vs. 21 blocked...especially after I marked them all approved.  I do have 33 comments, so the math is right.  

    Is there any way to know which ones Waegis thinks are blocked?  This is an awful lot of false positives so I'm a bit worried about how future comments will be handled.

    Thanks for any insight, and thanks for a great extension!

    P.S.  This comment form is a bit jacked up on IE7.  Using FF3 to post...  Cheers!

    • rtur.net

      5/3/2009 7:09:16 AM |

      Al, every time comment examined by Waegis counter at the bottom changes. If Waegis says it is spam than number of blocked incremented by one, otherwise approved goes up by one. Blocked comments have plus sign instead of a check mark in the list. If you look at example image on top of this page, first 3 comments are blocked and last 2 are approved.

      • Al Bsharah

        5/4/2009 9:34:19 AM |

        Thanks for the reply!

        I guess the confusion is that I have check marks all the way down, and zero plus signs.  Yet, I see the 12 vs 21 still at the bottom.

        As well, Waegis has yet to update any statistics on API calls etc, and I've run comment tests and even had a Busby comment come in.  Still no updates.

        Doesn't seem like things are right, but I've double-checked my URL and API Key...

        Am I missing something?

        • rtur.net

          5/4/2009 1:16:53 PM |

          Check on the settings page if you have manual filter turned on with set to auto approve. If you do, remove this filter and see if it will help.

          • Al Bsharah

            5/4/2009 1:39:02 PM |

            Yeah, just removed it.

            I now have 35 comments, but the bottom still says 12 and 21 (adds up to only 33).  Still no change on Waegis website.

            Is there any logging that can be set up for it?  Any other thoughts?  (thanks again for all the help!)

            • Steven

              5/12/2009 7:59:11 AM |

              I have this exact problem.  I only have 2 comments but the bottom says  Waegis: approved 12 blocked 21.  

              Haven't looked to see if this is hardcoded anywhere but that is my guess.

              • Steven

                5/14/2009 10:34:09 AM |

                it's amazing what happens when you read all the instructions.  Jut change lines 453 and 454 under AppCode/Extentions/Commentor.cs to 0.  Problem solved, just like you said in the instructions above.  Only I'm sure thi is the only time I've installed this...

  • Ben Amada

    5/12/2009 2:52:39 PM |

    Hi Rtur,

    I noticed today that when editing a comment, the changes aren't saved in the data store.  The culprit is the UpdateComment() method.

    protected void UpdateComment(Comment comment)
        foreach (Post p in BlogEngine.Core.Post.Posts)
            foreach (Comment c in p.Comments)
                if (c.Id == comment.Id)
                    c.Content = comment.Content;

    After c.Content is changed, no Save() method is called.  I put a p.Save() in there, but since the post wasn't marked as changed/dirty, it didn't do anything.  So I added a meaningless (temporary) update to the post's description so the post would get marked as changed.

    Also, because I'm now modifying the Post in a foreach, I cast Post.Posts and p.Comments to an array to avoid errors with modifying a collection while enumerating it.

    Mostly because of the meaningless update "hack", this is not the most elagant solution, but is working ...

    protected void UpdateComment(Comment comment)
        // Cast ToArray so the original collection isn't modified.
        foreach (Post p in BlogEngine.Core.Post.Posts.ToArray())
            // Cast ToArray so the original collection isn't modified.
            foreach (Comment c in p.Comments.ToArray())
                if (c.Id == comment.Id)
                    c.Content = comment.Content;

                    // Need to mark post as "changed" for it to get saved into the data store.
                    string desc = p.Description;
                    p.Description = (desc ?? string.Empty) + " ";
                    p.Description = desc;


    • rtur.net

      5/13/2009 1:45:45 AM |

      You right, once application restarted changes to comment body go away. I'll apply the fix later today, thanks for pointing this out.

      • Steven

        5/17/2009 1:19:31 PM |

        hi Rtur,

        Is this the fix you went with or did you change it another way?


        • rtur.net

          5/17/2009 1:55:34 PM |

          Last refresh has this exact fix with few code cleanups. Hard-coded 12/21 Waegis counts also replaced with zeros.

Pingbacks and trackbacks (9)+

Comments are closed