Checklist for high quality websites part 2

Jan 28, 2009
The second part of the checklist is about server side code and security [More]

Has privacy limited our possibilities?

Dec 12, 2007
Big Web 2.0 API's are restricting the amount of information for developers [More]

Create your own spam filter extensions

Dec 12, 2007
My last post about comment spam fighting resulted in a lot of e-mails from readers asking how to create their own spam fighting logic in BlogEngine.NET 1.3. So I decided to show a simple extension that listens for certain bad words and filters on those. If a comment contains one of the predefined words it is considered spam. The extension [Extension("Filters comments containing bad words", "1.0", "Mads Kristensen")] public class BadWordFilter {    // Constructor   public BadWordFilter()   {     // Add the event handler for the CommentAdded event     Post.AddingComment += new EventHandler<CancelEventArgs>(Post_AddingComment);   }    // The collection of bad words   private static readonly StringCollection BAD_WORDS = AddBadWords();    // Add bad words to the collection   private static StringCollection AddBadWords()   {     StringCollection col = new StringCollection();     col.Add("VIAGRA");     col.Add("CASINO");     col.Add("MORTAGE");      return col;   }    // Handle the AddingComment event   private void Post_AddingComment(object sender, CancelEventArgs e)   {     Comment comment = (Comment)sender;     string body = comment.Content.ToUpperInvariant();      // Search for bad words in the comment body     foreach (string word in BAD_WORDS)     {       if (body.Contains(word))       {         // Cancel the comment and raise the SpamAttack event         e.Cancel = true;         Comment.OnSpamAttack();         break;       }     }   }  } The problem with an extension that filters based on bad words is that if you have a blog about medicine then Viagra probably isn’t a bad word. Therefore this type of spam fighting is left out of the release, but is offered as a separate download where you are able to define your own bad words. Download BadWordFilter.zip (743 bytes)

Fighting spam attacks

Dec 11, 2007
Using the 404 HTTP status header to fight of spam attacks [More]

Use the provider model in ASP.NET 2.0

Dec 10, 2007
Get starting using the provider model of ASP.NET [More]

Protect your links from Visio

Nov 28, 2007
Visio's sitemap feature can be dangerous if you are not prepared for it. [More]

Re-enable request validation in ASP.NET

Oct 14, 2007
Enable HTML input without disabling request validation in ASP.NET [More]

URL parameter injections

Oct 2, 2007
SQL injection attacks are performed on this site on a daily basis. Scary... [More]

Worst spam day so far

Sep 19, 2007
I've never recieved as much spam as I did today. Comment, trackback and referrer spam. [More]

Invalid postback or callback argument

Aug 8, 2007
Shows that the exception is something to be happy to get. It means you're fighting spam. [More]

About the author

Mads Kristensen

Mads Kristensen
Program Manager at the Microsoft Web Platform team and founder of BlogEngine.NET.

More...

Month List

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer’s view in any way.