There are some steps to Add Captcha image in Asp.NET Application. You can download whole application from below link.You can easily add this captcha image to your Asp.Net Application Without facing any problem. You can add another captcha code also in any asp.net application from here.Both captcha codes will be provided full security to your asp.net application. Please follow these steps one by one which are given below.
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.
Step6:- Now open the web.config file and write the following codes as shown below.
see it:-
Step7:- Run the Application (press F5).
see it:
OUTPUT:-
Download whole attached application.
Step1:- First create ASP.NET page (Default.aspx) in visual studio 2010--> Now click the below link to download the 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.
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.
see it:-
Step7:- Run the Application (press F5).
see it:
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 Incorrect captcha image In the Text-Box and Click Verify Button,then we see following output :
Step8:-If you want to run this whole web application directly on your visual studio then follow below steps which are given below:-
- First Download this whole application from bottom and Extract it-->Copy this whole file (cltr+c).
- Now open your visual studio --> File --.New --.website -->Select ASP.NET Empty website -->OK -->Now open Solution Explorer -->Right click on project -->Paste this whole application which you have copied previously.
- Now Run the application-->then you can run this application successfully.
- If you are facing problem-->Download captcha.dll file from step 1 --> Extract it and copy all dll files -->open solution explorer -->Past this dll file in bin Folder.
- Now again run (press F5) then it will definitely work.
Please share this application with your friends so that it may helpful to others also.If any problem ask frequently.I will solve your doubt definitely.
For more Real Application...
- Add sql Database(.mdf) in Asp.Net Application
- Print the Grid Data in Windows Forms Application
- Create .dll File and Use in Asp.net Application
- Create a Setup File
- Take Print receipt in Windows Form Application
- File Handling Real Application
- Ado.Net Application
- Xml Application
- Create captcha image without dll file in asp.net application
- How to use WCF Services in asp.net application
- How to implement form based authentication in asp.net
- How to implement caching concepts in asp.net application
- How to send forget password from asp.net website
- How to use validation control in asp.net applicaton
DOWNLOAD
the characters matching with the captcha image characters are not case sensitive.I need to make a case sensitive match. Can some one help.
ReplyDeletethanx my friends, I am comming soon for new post.many times i have not written any post because i was doing training from C-dac in SECURITY Domain. Now i finished it now again i will write some good post which is helpful for learner(YOU).
ReplyDeletei am still not getting image on web page at local host
Deletecode is perfect.. bt itz not displaying the catcha image and so I cnt even enter the text.. plz help.. do revert back on steffi.aiesec@gmail.com
ReplyDeleteThis code is not working in Framework 3.5. Is there any updation to be done in the code?
ReplyDeleteWithout this captcha my main project is not working. Kindly help me to solve the problem.
hii,
ReplyDeleteim getting this error
in default.aspx file
element CaptchaControl is not a known element
Goodone I'll try it and use it on my website www.jokeshindi.com
ReplyDeleteWarning 1 Unable to update auto-refresh reference 'mscaptcha.dll'. Cannot find assembly 'D:\Documents and Settings\Administrator\Desktop\mscaptcha\MSCaptcha.dll'. C:\Users\HRAMAN\Documents\Visual Studio 2012\captcha\Bin\mscaptcha.dll.refresh captcha
ReplyDeleteif you are using my application,then first delete all mscaptcha.dll file from bin folder.close your application,after that open -->go bin folder and paste the all mscaptcha.dll file from step 1. you can use captcha image on your website without dll file Read it:-
ReplyDeletehttp://www.msdotnet.co.in/2013/09/how-to-create-captcha-image-without-dll.html
tnx ;)
ReplyDeletehow to create a newfolder ,if a am creating the bin folder it is already exist how to I create a bin folder
ReplyDeleteiMAGE GENERATION IS NOT TAKING PLACE....
ReplyDeleteError Creating Control - captcha1Unknown server tag 'rsv:CaptchaControl'...This error is coming..what is the solution???
ReplyDeletehi priya , try again ,otherwise download whole application from below and run directly on your visual studio .it will definitely work.........
DeleteIts working......!
ReplyDeletethanx :-)
My Captcha Image is Not displying i use same code..........
ReplyDeleteand also try in different browser also............!!
help me............
it is working try again carefully...........
Delete"TagePrefix" attribute missing and unknown server tag 'rsv:CaptchaControl '
ReplyDeletehelp me
you have not follow each steps correctly.see step 3 carefully ,try again with fresh application.it will work definitely.if you face problem again,contact me through contact form.
DeleteSIR please upload wpf tutorial with examples
ReplyDeleteit is giving error
ReplyDeleteUnrecognized configuration section compilation.
hi pankaj ! you have not follow each step carefully.Any way Follow another way
ReplyDelete1.) download whole application from bottom and extract it.-->open folder -->copy all files
2.) open your visual studio -->file --.New -->Website-->select ASP.NET Empty website -->ok
3.) open your solution explorer -->Right click on project --> paste the all file (which you have copied previous).
Now run the application it will work definitely.Please inform me if you run this application successfully..
Hi ,
ReplyDeleteI am using MsCaptcha for validation on my website but captcha image is not always displayed when website is hosted on cloud.It displayes a blank image with a red cross on left side of image ,if I right click on image and choose the option show picture then the image is displayed but I have to do this 2-3 times in order to see the image.Please help me out with it
Hi venkat !
Delete1.) set your AutoEventWireup properties="true"
2.) paste captcha dll file in bin folder
it may be helpful for you.
Hi,
ReplyDeleteThanks for your reply I already set the AutoEventWireup=true.But no use the captcha appears on a random basis.
It shows broken image several times then we have to refresh the 3-4 times then captcha appears automatically.
I am using the captcha image in the Blog section.Please help me out with it.
Hi Venkat ! You can use different method to generate captcha image from below link:
Deletehttp://www.msdotnet.co.in/2013/09/how-to-create-captcha-image-without-dll.html
The error says
ReplyDeleteThe type or namespace name 'MSCaptcha' could not be found in the global namespace (are you missing an assembly reference?)
Help me resolve this please
hi samia ! go step 3 and see ,i have registered Assembly =MsCaptcha ; then it will work......
DeleteThank you boss .. its working .. :)
ReplyDeleteyour article is very help full .. please make more user friendly ..
ReplyDeleteHi Sir Please See I have got error
ReplyDelete" WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive). "
Thanks a lot. it works very fine. its too simple to use also. I appreciate your work. :)
ReplyDeleteThanks a lot. It works very fine. I appreciate your work. :)
ReplyDeletethanks sir
ReplyDeleteHi this code work when i work local server if iam upload in public server this code not work show broken image after hosting how can i solve plz send replay to rizwan.thesohoy@gmail.com
ReplyDeleteThank You
Rizwan.
Hi, The code works perfactly on my local system but does not desplay image when run on the server. What can be the issue?
ReplyDeletewhat is the issue the captcha image doesnt get displayed when it is hosted on server pls reply....
ReplyDeleteWhen i copy and paste application then following errors comes
ReplyDeleteHTTP Error 500.23 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
Most likely causes:
This application defines configuration in the system.web/httpHandlers section.
Hi Purusottam, If you are getting error ,Follow each steps on your visual studio .You can easily remove your error....
DeleteHello friend pleas check out link....
ReplyDeletehttp://www.codescratcher.com/asp-net/captcha-image-using-c-asp-net/
Hi I downloaded your application and run it as it is. It is still giving the error
ReplyDelete1. Could not load file or assembly 'MSCaptcha' or one of its dependencies. The system cannot find the file specified.
2. Unknown server tag 'rsv:CaptchaControl'.
and a warning:
Element 'CaptchaControl' is not a known element. This can occur if there is a compilation error in the Web site, or the web.config file is missing.
I am using Visual Studio 2010 Express and .NET Framework 4.5
please add reference of MSCaptcha.dll ...
Deleteadd reference of MSCaptcha.dll then at will work fine......
ReplyDeleteHi,
ReplyDeleteHi i have downloaded your captcha image project it is running on localhost but it is not showing the captcha image after hosting on server.
Please do help ASAP.
Regards,
Nilesh
Hi I have same code and work perfectly fine only in root directory. Can any one tell me, what should I do to run this in folder not root directory?
ReplyDeleteCaptcha image is nt gettng????
ReplyDeleteAfter running, this was what i faced as the current problem with my App:
ReplyDelete"
HTTP Error 500.23 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode. "
Any help? Thanks in advance
hiii....
ReplyDeleteI am not able to download captcha file from your dropbox link plz help me.
It was showing error---> "file not found""dropbox-404"