In Asp.Net forums and in many other user communities I have seen lot of people asking for VB.Net CAPTCHA. So I thought to write a blog post and create some sample implementations. The zip file contains C# CAPTCHA and VB.Net CAPTCHA. I have included the samples for Asp.Net AJAX CAPTCHA also.
You can download the samples and implementation from here
Implementing Asp.Net AJAX CAPTCHA is really simple. Just wrap the main Asp.Net CAPTCHA with Asp.Net AJAX update panel and put a random query string at the end of CAPTCHA image src. The random query string will avoid showing the old CAPTCHA from browser cache.
STEPS TO ADD ASP.NET CAPTCHA IN YOUR WEBSITE
- Refer the assembly CaptchaDLL.dll in your project
- Copy JpegImage_CS.aspx or JpegImage_VB.aspx (according to the language of choice) to your website.
- Open the above file and make changes in Colors and Font if needed. (read the inline comments to know more)
- Now user the sample codes from Default.aspx or Ajax.aspx pages. The code is straight forward. You make a session and generate an image with the string in the Session. Now when you submit you have to check the session value and textbox value to see whether the entered CAPTCHA is correct.
If you have any questions please put as a comment.
Tags
Asp.Net CAPTCHA, CAPTCHA, VB.Net CAPTCHA, C# CAPTCHA, ASP CAPTCHA, C sharp captcha, vb captcha, simple captcha, AJAX CAPTCHA, asp.net ajax captcha, captcha without refresh, captcha using ajax, numeric captcha
23 comments:
Good one,
Thanks
Saqib Vaid
Excellent..
Is it free to use this CAPTCHA tool in my web site? Or I required some agreement, licensee? Thank you
Great. Thanks for your sharing.
@ST
Its free and there is no licenses needed to use in your projects..
Great to see. I have been searching around for one that was UpdatePanel agnostic. Thank you.
Captcha image disappears as soon as I sign out and come back to the captcha page. It never comes back again. Please help me out.
Thanks
Raj.
Captcha image disappears after logout. And it never comes back. Please help me out!
Thank you very much.
Nice and easy.
Obviously new to ASP/AJAX by this comment ....
What is meant by "Refer the assembly CaptchaDLL.dll in your project" and how do you it?
Scott
@Raj
I think the folder contaning JpegImage_CS.aspx (JpegImage_VB.aspx ) does not have anonymous permission.. Try accessing the page directly (like http://localhost/yoursite/JpegImage_CS.aspx ) and see whether its redirecting to login page...
If so you need to give anonymouse permission to that file...
See thios link to know how you can exclude a page from security settings...
http://support.microsoft.com/kb/316871
@Scott
You need to add reference of that assembly in your project..
In the Visual studio right click on the solution explorer and select Add reference.. now go to Browse tab and browse the CaptchaDLL.dll from the downloaded source.. click OK'..
See the following links for more details
http://msdn.microsoft.com/en-us/library/wkze6zky(VS.80).aspx
http://www.csharp411.com/adding-assemblies-to-the-visual-studio-add-reference-dialog/
Regards
Anz
Thanks for the reply. I found that about an hour ago online.
Now the problem is that the Captcha image is not appearing. I have this in a login control. Funny thing is that if I replace the src="JpegImage_VB.aspx" with a graphic from my Images folder, the image doesn't display either.
The JpegImage_VB.aspx file is in the sites root directory. When I start with debugging and have a breakpoint in the JpegImage_VB.aspx file it doesn't appear the file is being executed.
When the login comes up, the alt text "Visual Verification" appears.
Any ideas?
Sweet!!!!!!!!!!!!!!!
Looks Good.
Can't thank you enough for your help.
@Anzer
Thanks a lot! That worked!
Raj.
@Scott
you got it working???
if no please refer to my reply to Raj.. that may be the reason the image not displaying
http://anzme.blogspot.com/2008/10/i-am-using-great-asp.html?showComment=1241716980000#c3538917920615613706
cool sample.. thanks for sharing..
Thanks very much! You saved me a week...!
Indeed, very nice! Thanks...
Thanks for the tool, may i know if it has the ability to switch to small and large cases, like "Djts7cjP"?
I'm sry but I'm new.
I've tryed for hour to put captcha in my web page but I can't do that the image don't appear I see the error "Visual Verification".
I'm not sure to have do right thing.
Can u tell step by step what I have to do?
What I must put in the folder and where? thx a lot
-BiFe-
Thanks for a wonderful control and the test project. Couldn't be more perfecter... (if thats a word)
Thanks for the CAPTCHA code, it works well. The only problem I'm having after inserting the code is that the refresh button has to be clicked once in order for the image to show up for the first time on page load. Is there something that needs to be called in the Page_Init or Page_Load for it to work properly?
Thanks for your help!
Great help for me!
Thanks a lot
Anthony
Post a Comment