|
This post originated from an RSS feed registered with .NET Buzz
by Jonathan Cogley.
|
Original Post: Adding CAPTCHA to FlexWiki
Feed Title: Jonathan Cogley's Blog
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/jcogley/Rss.aspx
Feed Description: C#, Test Driven Development, Remote Scripting, CShark! :)
|
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Jonathan Cogley
Latest Posts From Jonathan Cogley's Blog
|
|
Blog spam sucks but being hosted on weblogs.asp.net doesn't leave a lot of options at the moment. Blog spam could seen as 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 on Captcha 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: Browsing the 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 <form>. Finally I gave up on the control and used the HIPCodeGenerator class directly.
- Follow Miguel's installation instructions in readme file of the 1.1 release (the readme isn't in 1.2)
- Download my modified FlexWiki wikiedit.aspx code behind here.
- Note the new AddHipCodeToPage and IsValidHipCode methods.
- There are also some small changes to the processing of DoPage to ensure the Captcha is enforced.