Hai ! There are some steps to Add Captcha image in Asp.NET Application.You can easily add this captcha image to your Asp.Net Application Without any Problem.
Please follow these steps one by one which are given below.
Step1:-
First create ASP.NET page (Default.aspx) in visual studio 2010--> Now download the captcha.dll file from Microsoft Site.
see captcha.dll file:-
Step2:-
Now Open Solution Explorer -->Add new Folder(Bin)->open the captcha.dll file->copy all the file -> Now paste it in the Bin Folder.
see it:-
Step3:- Now Write the code for captcha control in Source file as shown below:
see it:-

Step5:- Now Double click on Button control(Verify) and write the following code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
captcha1.ValidateCaptcha(TextBox2.Text.Trim());
if (captcha1.UserValidated)
{
Label1.ForeColor = System.Drawing.Color.Green;
Label1.Text = "You have Entered Valid Captcha Characters";
}
else
{
Label1.ForeColor = System.Drawing.Color.Red;
Label1.Text = "You have Entered InValid Captcha Characters please Enter again";
}
}
}
see it:-
Step6:- Now open the web.config file and write the following codes as shown below.

Step7:- Run the Application (press F5).
OUTPUT:-
when we Enter the correct captcha image In the Text-Box and click Verify Button,then we see following output:-
when we Enter the In-correct captcha image In the Text-Box and click Verify Button,then we see following output:-

Please follow these steps one by one which are given below.
Step1:-
First create ASP.NET page (Default.aspx) in visual studio 2010--> Now download the captcha.dll file from Microsoft Site.
see captcha.dll file:-
Step2:-
Now Open Solution Explorer -->Add new Folder(Bin)->open the captcha.dll file->copy all the file -> Now paste it in the Bin Folder.
see it:-
Step3:- Now Write the code for captcha control in Source file as shown below:
see it:-
Step4:- Now Drag and Drop Text-box,Button, Label and Validation controls on Default.aspx page from the Toolbox.which is as shown below:-
see it:-Step5:- Now Double click on Button control(Verify) and write the following code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
captcha1.ValidateCaptcha(TextBox2.Text.Trim());
if (captcha1.UserValidated)
{
Label1.ForeColor = System.Drawing.Color.Green;
Label1.Text = "You have Entered Valid Captcha Characters";
}
else
{
Label1.ForeColor = System.Drawing.Color.Red;
Label1.Text = "You have Entered InValid Captcha Characters please Enter again";
}
}
}
see it:-
Step6:- Now open the web.config file and write the following codes as shown below.
Step7:- Run the Application (press F5).
OUTPUT:-
when we Enter the correct captcha image In the Text-Box and click Verify Button,then we see following output:-
when we Enter the In-correct captcha image In the Text-Box and click Verify Button,then we see following output:-
No comments:
Post a Comment