October 2, 2004
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
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.
Hm, could you update the link to the zip perhaps?
The link is broken for the download!
I'd like to compile and register this control with the machine.config. Would the code require modification for use at a machine level? A namespace declaration or other modification?
How do you set the error message when the user text does not match the image. I have looked in your sample code default.aspx and default.cs and can not find anything.
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.