An ASP.NET CAPTCHA Server Control

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:

This is a companion discussion topic for the original blog entry at:

Very nice!

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 :wink:

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.

There’s also a great MSDN article on this topic here:

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.

Looks like the MSDN URL has changed; I suspect it refers to this (very good) article:

<a href=""></a>

This is based upon the .NET 1.x framework.

Regards, Matt

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

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?


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.

Please help.


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!

There is an AJAX compatible version here: