Home > .NET, Fun > Adding CAPTCHA to FlexWiki

Adding CAPTCHA to FlexWiki

Blog spam sucks but being hosted on weblogs.asp.net doesn’t leave a lot of options at the moment. Blog spam couldseenas a personal attack on your good nature and an attempt to mess with your small expression outlet to the rest of the world? Wiki spam on the company wiki however,is outright war! 🙂

Thanks to Jeff for pointing me towards Miguel Jimenez’s Clearscreen SharpHIP HIP-CAPTCHA Control.(More onCaptcha technology here).

Miguel’s Captcha code takes the form of a custom WebControl which should make it very easy to integrate into most ASP.NET applications. Add it to a form, simple validation and the post doesn’t go through without the right Captcha response.

Problem: Browsingthe FlexWiki code base I realised that it doesn’t really use the WebControl/Postback/Validation model. The entire page is rendered by the DoPage method. Does this strike anyone else as odd, since FlexWiki started as an internal Microsoft application?

Solution: My attempts at dynamically loading the control or placing it on the .aspx all failed since FlexWiki doesn’t use a server side

. Finally I gave up on the control and used the HIPCodeGenerator class directly.

  1. Follow Miguel’s installation instructions in readme file of the 1.1 release (the readmeisn’t in 1.2)
  2. Download my modified FlexWiki wikiedit.aspx code behind here.
    • Note the new AddHipCodeToPage andIsValidHipCode methods.
    • There are also some small changes to the processing of DoPage to ensure the Captcha is enforced.

Categories: .NET, Fun
  1. Miguel Jimenez
    February 2, 2005 at 12:10 am

    Hi Jeff, you should try with version 1.3 of the control. It includes now an IsValid attributed and you can include the control in your code in a better an easier way (i guess)

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: