A Captcha is a program that protects website against bots by generating tests that humans can pass but current computer programs cannot. For Example : Human can read distorted text as given in example but current computer programs cannot.The " MSCaptcha.dll" file provides a user control for randomly generating Captcha images.
Source Code For Captcha Control <%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="cap" %> <cap:CaptchaControl ID="captcha1" runat="server" CaptchaLength="5" CaptchaHeight="50" CaptchaWidth="200" CaptchaLineNoise="None" CaptchaMinTimeout="3" CaptchaMaxTimeout="240" ForeColor="Blue" BackColor="Yellow" CaptchaChars="ABCDEFGHIJKLMNOPQRSTUVWX123456789" Height="46px" Width="200px" /> ------------------------------ Webconfig File Setting in <system.web> -------------------------------------- <authentication mode="Windows"/> -------------------------------------- Webconfig File Setting ---------------------------------------- <system.webServer> <handlers> <add name="captcha1" verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha" /> </handlers> </system.webServer> --------------------------------- Important Namespaces Used --------------------------------- using System.Data; using System.Data.SqlClient; --------------------------------- Subscribe Button Click Event Coding ----------------------------------- captcha1.ValidateCaptcha(TextBox2.Text.Trim()); if (captcha1.UserValidated) { String query = "insert into emaildetail(emailaddress) values('" + TextBox1.Text + "')"; String mycon = "Data Source=sk-pc; Initial Catalog=NewsletterDatabase; Integrated Security=true"; SqlConnection con = new SqlConnection(mycon); con.Open(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = query; cmd.Connection = con; cmd.ExecuteNonQuery(); Label3.Text = "Thanks For Subscribing Our Email Newsletter - Keep Visit Website Also"; TextBox1.Text = ""; TextBox2.Text = ""; } else { Label4.Text = "Incorrect Captcha Text - Re-enter Carefully"; }