Arne Brachhold

Akismet C# API for the .Net Framework 1.1 and 2.0

Filed under: .Net,Wordpress — arne on April 18, 2006
Latest release:

This is a little Microsoft .Net class which allows you to use the powerful Akismet comment spam protection in your .Net wiki/blog/website/software.

It’s well documented and available as a precompiled library or C# project. It’s compiled as .Net 1.1, but also works great with 2.0. Note that you need to obtain a API key to use it.

Commercial use:
The personal use of Akismet is completely free, but if you are a really heavy user or want to use it in a commercial way, please see this offers for details.

This library is licensed under the GPL. Because it is licensed free of charge, I do not accept any responsibility for any damages, direct or indirect, that may arise from using the library. This software is provided “AS IS” without warranty of any kind. Please refer to the full version of the GPL for more details.

Download Icon Precompiled, strong named binary
Download Icon Project with source code

Please contact me or comment on this post if you encounter any problems or bugs.

Usage is very simple, Intellisense is available for all methods and fields.

  1. //The manager handles all API stuff
  2. AkismetManager mngr = new AkismetManager("YOUR-API-KEY","");
  4. //An item is a single comment or registration data
  5. AkismetItem comment = new AkismetItem("Ip-of-commenter","Useragent-of-commenter");
  6. comment.AuthorName="Comment Author";
  7. comment.AuthorEmail="";
  8. //There are many more fields to specify. Submit as much fields as possible to get the most accurate and fastest results.
  10. //Validate your API key
  11. if(mngr.IsValidKey()) {
  12.     //Check if the comment is spam
  13.     if(mngr.IsSpam(comment)) {
  14.         //Store in DB and mark it as spam
  15.         //or Submit it as ham (not spam)!
  16.         mngr.SubmitHam(comment);
  18.     } else {
  19.         //Store in DB and publish
  20.         //or submit as spam!
  21.         mngr.SubmitSpam(comment);
  22.     }
  23. }