Akismet Spam Detection in .Net
I finally got fed up with the amount of spam that is coming in through the comments form so decided to look into spam detection. It seems that Akismet is pretty much the standard for this. There is a .Net library that wraps around the Akismet API and I am pretty happy with how easy it was to get it hooked up.
Akismet api = new Akismet("AKISMET_API_KEY", "http://rickyrosario.com", "Ricky's Custom Blog/v1 | Akismet.Net 1.0.1");
AkismetComment c = new AkismetComment();
c.Blog = "http://rickyrosario.com";
c.UserIp = comment.AuthorIP;
c.UserAgent = comment.AuthorUserAgentString;
c.CommentContent = comment.Content;
c.CommentType = "comment";
c.CommentAuthor = comment.Author;
c.CommentAuthorEmail = comment.AuthorEmail;
c.CommentAuthorUrl = comment.AuthorUrl;
isSpam = api.CommentCheck(c);
if (!isSpam) {
comment.IsRejected = false;
} else {
comment.IsRejected = true;
}
blog comments powered by Disqus