Captcha Image using C#

cap

Earlier, when I was not much into Information Technology. I didn’t know about a lot of things, one of them being ‘Captcha Code’. I thought that what can be the reason for them asking a user to type a code that is written in a particular way. About 7-8 months ago, I came to know what really Captcha Code meant for. Captcha stands for “Completely Automated Public Turing Test to Tell Computers and Human Apart”. Acronym of Captcha itself explains the need for a Captcha code. It is used to prevent ‘Spamming’ which include submitting forms automatically through computer. Hence, this code is highly effective in differentiating between human and computers as computers aren’t programmed to answer such question.

How we can Create Captcha?

In above code, there are two controls TextBox and Image control for verifying whether entered code is matched or not. Where TextBox is to take input from user and Image control is to hold the image automatically generated by GenerateCaptcha.aspx page.

s2

Default.aspx

s3

GenerateCaptcha.aspx

This code is applied to generate random string and transfer it to class file which covert it into image format (JPEG). With the help of BitMap class it generates Image.

s4

Default.aspx.cs

In button’s click event, we are verifying that entered value in Textbox is matching with Image string or not. According to result we display the appropriate message on screen.

OUTPUT:

s1

Your email address will not be published. Required fields are marked *

Contact CPD Technologies






    [recaptcha]