Why isn't the captcha working in this asp page?

Posted on 2012-08-28
Medium Priority
Last Modified: 2012-08-30
I have a page here:


that I've inserted code for captcha I found here: http://www.tipstricks.org/

but for some reason it does not work.

I've included the reserve.asp code.

Any help would be appreciated.
Question by:Donnie Walker
  • 2
LVL 54

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 750 total points
ID: 38341846
You have to have the code on both the form page and response page
LVL 61

Accepted Solution

Julian Hansen earned 750 total points
ID: 38341925
You don't appear to be any form validation on the server side - clicking ok on the empty form submits the form and gives you a thank you page.

You will need to add some server code that checks your form variables to ensure they are valid for the fields they are entered for.

This applies to the captcha as well.

Take a look at this code snippt from the ZIP you downloaded. You need to implement something similar in your code.
        if Request.ServerVariables("REQUEST_METHOD") = "POST" and IsEmpty(Request.Form("btnRetry")) then
            Dim lblResult, lblColor
            if IsEmpty(Session("ASPCAPTCHA")) or Trim(Session("ASPCAPTCHA")) = "" then
                lblResult = "This test has expired."
                lblColor = "red"
                Dim TestValue : TestValue = Trim(Request.Form("txtCaptcha"))
                '//Uppercase fix for turkish charset//
                TestValue = Replace(TestValue, "i", "I", 1, -1, 1)
                TestValue = Replace(TestValue, "I", "I", 1, -1, 1)
                TestValue = Replace(TestValue, "i", "I", 1, -1, 1)
                TestValue = UCase(TestValue)
                if StrComp(TestValue, Trim(Session("ASPCAPTCHA")), 1) = 0 then
                    lblResult = "CAPTCHA PASSED"
                    lblColor = "green"
                    lblResult = "CAPTCHA FAILED"
                    lblColor = "red"
                end if
                '//IMPORTANT: You must remove session value for security after the CAPTCHA test//
                Session("ASPCAPTCHA") = vbNullString
            end if

Open in new window

LVL 54

Expert Comment

by:Scott Fell, EE MVE
ID: 38341947
The sample code is for the form and response on the same page. You  are posting to a cfm page.  I answered your original question that was deleted for the same thing. You would be better off going back to the reCaptcha example and using the client side javascript version to use both asp and cfm.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question