October 1, 2004
A few days ago, I found a really cool CAPTCHA ASP.NET code sample. I converted it to VB.NET and repackaged it as a full blown ASP.NET server control:
It's as simple as I could make it: a total drag and drop, set the (three) properties and forget it implementation. The only tricky part was dealing with the dynamically generated image. You will have to add this HttpHandler section to your web.config file when you use the CaptchaControl
<add verb="*" path="CaptchaImage.aspx"
type="WebControlCaptcha.CaptchaImageStream, WebControlCaptcha" />
You can download the zipped VS.NET 2003 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.
I should also mention that I tested this CAPTCHA against OCR software, specifically OmniPage Pro 14. It does suprisingly well for a couple key reasons-- low contrast, and all the characters are warped. It's possible to defeat it, but it's definitely not a trivial "drag to OCR window" situation. My kudos to BrainJar for coming up with this simple yet effective CAPTCHA.
Posted by Jeff Atwood
I developed one of these myself (in C#, however) and have it working on my site (link above).
Brady, very cool, although I suspect that is very OCR-able due to the high contrast and lack of warping. Probably doesn't matter since the effort bar has already been raised, but for the record ;)
I made another small improvement: I am using a HttpHandler instead of a HttpModule. That way I don't have to test every request for a page name.. the handler only fires for that one page.
The codeproject link doesn't work any more. Is there an updated Url?
Sure, that's no problem. Scott Hanselman already included the CAPTCHA in his release of dasBlog as well.
For me, I have found that the control doesn't work when it resides on a page that uses master pages. When the control is on a basic *.aspx page, it works fine. However, the site I want to use this with uses master pages. Can you help me to understand why that may be?? In laymen's terms as well. I am not a code guru.
I have solved my problem. There was a CSS conflict with my stylesheet and the styles applied to the DIV/SPAN elements within the control itself. It was also only an IE 6 bug as well. I stripped out all of the styles from your control and it worked with my stylesheet!
Very nice! and very helpful. I shall use it in my .net projects.
Nice work, Jefferson.
Why did you choose not to use it on codinghorror.com?
The 2.0 project download on The Code Project is missing the CaptchaImage.aspx file.
One question and one comment...
First, great control! You saved me a ton of time. =)
Now, for the question...
I'm using your controlw ith a Template version of the Login control. Unfortunately, the control appears to not have any events that fire upon failure. I would to display a simple error to my user when they make a typo in the CAPTCHA.
Any thoughts or recommendations?
dev astha shefalii arshi pawan
It is a great control and i am using it in a project.
The only problem is sometime the CAPTCHA image can not be displayed and i have to re-start IIS.
anyone happen to have a C# version?
where is source code of this control...
and runtime files...
Where's the source code? The link is broken!
hola a todos buen blog
Entrar a esteblog es interesante
For windows vista, you have to add:
add name=CaptchaImage path=CaptchaImage.aspx verb=GET type=WebControlCaptcha.CaptchaImageHandler resourceType=Unspecified preCondition=integratedMode /
in handlers section.
Cool stuff, thanks. I'm actually thinking of wrapping this up in a DotNetNuke module, if it's ok with you.