Here we discuss about how to create Captcha using DLL
.aspx File
<%@ Register Assembly=โMSCaptchaโ Namespace=โMSCaptchaโ TagPrefix=โcc1โณ %>
<form id=โform1โณ runat=โserverโ>
<div>
<cc1:CaptchaControl ID=โCaptcha1โณ runat=โserverโ
CaptchaBackgroundNoise=โLowโ CaptchaLength=โ5โณ
CaptchaHeight=โ60โณ CaptchaWidth=โ200โณ
CaptchaLineNoise=โNoneโ CaptchaMinTimeout=โ5โณ
CaptchaMaxTimeout=โ240โณ FontColor = โ#529E00โณ />
</div>
<asp:TextBox ID=โtxtCaptchaโ runat=โserverโ></asp:TextBox>
<br />
<asp:Button ID=โbtnVerifyโ runat=โserverโ Text=โVerifyโ OnClick=โbtnVerify_Clickโ />
<asp:RequiredFieldValidator ID=โRequiredFieldValidator1โณ runat=โserverโ ErrorMessage=โ*Requiredโ ControlToValidate = โtxtCaptchaโ></asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID=โlblMessageโ runat=โserverโ Font-Names = โArialโ Text=โ”></asp:Label>
</form>
CodeBehind File
protected void btnVerify_Click(object sender, EventArgs e)
{
Captcha1.ValidateCaptcha(txtCaptcha.Text.Trim());
if (Captcha1.UserValidated)
{
lblMessage.ForeColor = System.Drawing.Color.Green;
lblMessage.Text = โValidโ;
}
else
{
lblMessage.ForeColor = System.Drawing.Color.Red;
lblMessage.Text = โInValidโ;
}
}
Note : Download .dll here
Leave A Comment