Captcha Image using C#
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.
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.
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.