ASP Classic CAPTCHA Built-In Troubleshooting VBScript Code Example (BotDetect ASP v4.x; discontinued)

The ASP Classic Captcha troubleshooting code example shows how to use the BotDetect Troubleshooting helper to debug BotDetect CAPTCHA issues.

This helper can help diagnosing and resolving any BotDetect issues you might encounter on your servers.

First Time Here?

Check the BotDetect Developer Crash Course for key integration steps.

You just have to copy the BotDetectDebug.asp file to your project, and the <%=ExampleCaptcha.Troubleshooting %> statement will display Captcha instance and persistence values.

Download the BotDetect Classic ASP CAPTCHA Component and run this sample

Installed Location

By default, the Classic ASP basic Captcha code example is installed at:
C:\Program Files\Captcha Inc\BotDetect 4 CAPTCHA Component\Asp\WebApp\CaptchaTroubleshootingExample

You can also run it from the BotDetect Start Menu:
Programs > Captcha Inc > BotDetect 4 CAPTCHA Component > ASP > Web Applications > Run

Default.asp

<!-- #include file ="BotDetect.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
  <title>BotDetect ASP Classic CAPTCHA Options: Troubleshooting Helper Code 
  Example</title>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <link type="text/css" rel="Stylesheet" href="<%= CaptchaUrls.LayoutStylesheetUrl() %>" />
  <link type="text/css" rel="Stylesheet" href="StyleSheet.css" />
</head>
<body>
  <form method="post" action="" class="column" id="form1">

    <h1>BotDetect ASP Classic CAPTCHA Options: 
    <br /> Troubleshooting Helper Code Example</h1>
    
    <fieldset>
        <legend>ASP Classic CAPTCHA validation</legend>
        <label for="CaptchaCode">Retype the characters from the picture:</label>
        
        <% ' Adding BotDetect CAPTCHA to the page 
          Dim TroubleshootingCaptcha : Set TroubleshootingCaptcha = (New Captcha)
          ("TroubleshootingCaptcha")

          TroubleshootingCaptcha.Locale = "en-CA"
          TroubleshootingCaptcha.CodeLength = 4
          TroubleshootingCaptcha.CodeStyleName = "Numeric"
          TroubleshootingCaptcha.ImageStyleName = "Fingerprints"
          TroubleshootingCaptcha.ImageWidth = 200
          TroubleshootingCaptcha.ImageHeight = 80
          TroubleshootingCaptcha.ImageFormatName = "gif"
          TroubleshootingCaptcha.SoundStyleName = "Pulse"
          TroubleshootingCaptcha.SoundFormat = 1
          TroubleshootingCaptcha.SoundFormatName = "WavPcm8bit8kHzMono"

          TroubleshootingCaptcha.UserInputID = "CaptchaCode"
        %>
        
        <%=TroubleshootingCaptcha.Html %>
        
        <div class="validationDiv">
            <input name="CaptchaCode" type="text" id="CaptchaCode" />
            <input type="submit" name="ValidateCaptchaButton" value="Validate" 
            id="ValidateCaptchaButton" />
            
            <% ' CAPTCHA user input validation (only if the form was sumbitted)
              If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
                Dim isHuman : isHuman = TroubleshootingCaptcha.Validate()
                If Not isHuman Then 
                  ' CAPTCHA validation failed, show error message
                  Response.Write "<span class=""incorrect"">Incorrect code</span> "
                Else 
                  ' CAPTCHA validation passed, perform protected action
                  Response.Write "<span class=""correct"">Correct code</span>"
                End If 
              End If
            %>
        </div>
    </fieldset>
    
    <%=TroubleshootingCaptcha.Troubleshooting %>
  </form>
</body>
</html>

The form follows the basic procedure for Captcha object properties to make troubleshooting functionality more obvious.

We can then output the ExampleCaptcha.Troubleshooting value, as explained in the BotDetect troubleshooting guide.

BotDetect\CaptchaConfig.asp

<%

' BotDetect ASP Captcha configuration options
' ---------------------------------------------------------------------------
BotDetect.ImageWidth = 200
BotDetect.ImageHeight = 80
BotDetect.HelpLinkMode = BDC_HelpLinkModes("Image")

%>

The ASP Captcha library configuration file defines base Captcha settings for the example.


Please Note

The information on this page applies to a discontinued version of BotDetect™ ASP CAPTCHA (v4.x)