Florence Blogspot about asp.net tutorials and web design and web development

Monday, July 6, 2009

Asp.Net CAPTCHA and Asp.Net AJAX CAPTCHA

Asp.Net CAPTCHA and Asp.Net AJAX CAPTCHA

I am using a great Asp.Net CAPTCHA by BrainJar in a number of web sites with and without Asp.Net AJAX. It’s a simple and really easy to use Asp.Net CAPTCHA. The actual source code is in C#, but you can use it with both C# and VB.Net by simply wrapping the functionality in a class library.

In Asp.Net forums and in many other user communities I have seen lot of people asking for VB.Net CAPTCHA. So I thought to write a blog post and create some sample implementations. The zip file contains C# CAPTCHA and VB.Net CAPTCHA. I have included the samples for Asp.Net AJAX CAPTCHA also.

You can download the samples and implementation from here

Implementing Asp.Net AJAX CAPTCHA is really simple. Just wrap the main Asp.Net CAPTCHA with Asp.Net AJAX update panel and put a random query string at the end of CAPTCHA image src. The random query string will avoid showing the old CAPTCHA from browser cache.

STEPS TO ADD ASP.NET CAPTCHA IN YOUR WEBSITE
  1. Refer the assembly CaptchaDLL.dll in your project
  2. Copy JpegImage_CS.aspx or JpegImage_VB.aspx (according to the language of choice) to your website.
  3. Open the above file and make changes in Colors and Font if needed. (read the inline comments to know more)
  4. Now user the sample codes from Default.aspx or Ajax.aspx pages. The code is straight forward. You make a session and generate an image with the string in the Session. Now when you submit you have to check the session value and textbox value to see whether the entered CAPTCHA is correct.
DOWNLOAD THE SOURCE AND SAMPLES FROM HERE

If you have any questions please put as a comment.

1 comment:

web design company said...

I would like to appreciate you the way you have shared the post with us. It is really hard to find the quality post, but you have done this job nicely man.

Search