I <3 Steve McConnell*
Coding Horror
programming and human factors
by Jeff Atwood

October 02, 2004

ASP.NET CAPTCHA control, improved

I improved the ASP.NET CAPTCHA server control I mentioned yesterday:

  • Control respects all standard ASP.NET server control properties (font, border, accesskey, enabled, etcetera)
  • Hide ViewState property (it's required!)
  • Added CaptchaLength property
  • Added CaptchaFontWarping property
  • Improve font sizing algorithm
  • Improve warping algorithm (more mild distortion, no more drawing outside the box)
  • Remove "1,0,I,O" from possible Captcha characters to prevent confusion in entering text
  • Text is now optional
  • lots of other little improvements
If you are willing to sacrifice less OCR-ability for more human readability, you can adjust the CaptchaLength and CaptchaFontWarping properties to taste. For most applications, simply having a captcha of any sort is probably enough to block casual bot attacks, and shorter less warped phrases are definitely a lot easier to read. The default is 6 characters with medium warping, which is a good blend.

You can download the solution from my CodeProject article if you're interested. There are only two projects in the solution; an ultra simple demo website and the control library itself.

To see a CAPTCHA in action, check out the Yahoo mail signup page. Refreshing the page will generate a new one every time..

Posted by Jeff Atwood    View blog reactions

 

« An ASP.NET CAPTCHA Server Control Double-Click Must Die »

 

Comments

Jeff,

I'd love to use this control, but your distribution model is lacking. If you could distribute the binary (I can't find it anywhere in the ZIP file) that would make it brain-dead simple. I tried to open your .sln file, which is looking for "homeserver" - once I fixed that, then it complains about the code being under source control, and then it can't find the WebApplicationCaptcha project because the path in the .sln is hardcoded to something specific on your computer.

Regards,

Jason

Jason Bock on January 2, 2005 12:49 PM

Are you sure you're working with the latest ZIP file from the article?

I now transfer all the solutions to my laptop and strip the source control bindings, revert to localhost, etc, before packaging it up. The current version of the article (but NOT previous versions) should reflect this. It was updated about 2 weeks ago.

I just downloaded the zip file from the article and ran it on the laptop, using localhost, no problem.

I can include a binary in future versions, though.. that's a good idea.

Jeff Atwood on January 2, 2005 04:47 PM

Hm, could you update the link to the zip perhaps?

Morten on July 31, 2006 02:30 AM

The link is broken for the download!

9key on May 12, 2008 02:12 PM







(hear it spoken)


(no HTML)




Content (c) 2008 Jeff Atwood. Logo image used with permission of the author. (c) 1993 Steven C. McConnell. All Rights Reserved.