Category Archives: captcha

How to create a simple captcha validation in asp.net

We often see captcha validation in number of sites outthere. Earlier, when I started surfing in web, I wondered how they are created. But now I have answer for that.I am presenting you before, a simple method to implement a captcha validation in your asp.net websites (PHP folks, cheer up. I am working on a similiar thing in php too.). In this method I am using System.Drawing namespace in C#. First I am going to create a generic handler which will render the captcha image.Look at the code below

And now we are going to implement the validation. Create an aspx page, add add an img tag and for the src attribute,give the path to the handler. See below.

And now it’s time for testing the validation. Code behind will look like this.

And we are done! The validation form will look like this. Download sample project Try this and let me know the feedback.Cheers