BotDetect CAPTCHA ASP Classic Code Samples (BotDetect v3.0; deprecated)

First Time Here?

Check the BotDetect Developer Crash Course for key integration steps.

The BotDetect ASP Classic Captcha installations include a number of code samples which can help you get started with integrating BotDetect in your Classic ASP applications and configuring various Captcha options.

Table of Contents

BotDetect CAPTCHA ASP Classic Code Samples Installation

When you run the BotDetect ASP Captcha component setup package, you'll be given a choice of features to install:

BotDetect ASP Setup feature selection

Note that:

  • By default, all features are selected
  • Selecting Samples installs the BotDetect web application files – demos and samples source code.
  • Selecting Deploy to IIS deploys the BotDetect web applications to localhost, creating IIS applications running in a separate application pool.
  • If setup detects that you don't have IIS and .NET Framework version 2.0 or newer (required since the Captcha COM component used for Captcha image and sound generation is a .NET component) installed on the machine, the Deploy to IIS option won't be shown.

When the web applications are installed, you can view their source code in the BotDetect installation folder and run them using the provided Start Menu shortcuts:

Default Installation Folder Start Menu Shortcut
C:\Program Files\Lanapsoft\BotDetect 3 CAPTCHA Component\Asp\WebApp Start -> Programs -> Lanapsoft -> BotDetect 3 CAPTCHA Component -> ASP -> Web Applications

BotDetect CAPTCHA ASP Classic Developer Crash Course

Be sure to check our Developer Crash Course to quickly learn the few key integration steps.

BotDetect ASP CAPTCHA Integration Code Samples

Integration code samples show how to integrate BotDetect in your ASP applications.

ASP Basic CAPTCHA Code Sample

This code sample shows the most basic source code required to protect an ASP form with BotDetect Captcha and validate the user input.

It can be used as a starting point when you are first learning how to use BotDetect.

Default Source Code Folder Online Source
C:\Program Files\Lanapsoft\BotDetect 3 CAPTCHA Component\Asp\WebApp\AspBasicCaptchaSample

ASP Form CAPTCHA Code Sample

This code sample shows how to add BotDetect Captcha protection to a typical ASP form.

Captcha validation is integrated with other form fields validation, and only submissions that meet all validation criteria are accepted.

This kind of validation could be used on various types of public forms which accept messages, and are at risk of unwanted automated submissions.

For example, it could be used to ensure bots can't submit anything to a contact form, add guestbook entries, blog post comments or anonymous message board / forum replies.

Default Source Code Folder Online Source
C:\Program Files\Lanapsoft\BotDetect 3 CAPTCHA Component\Asp\WebApp\AspFormCaptchaSample

ASP Login CAPTCHA Code Sample

This code sample shows how to add BotDetect Captcha validation to simple ASP login forms.

To prevent bots from trying to guess the login info by brute force submission of a large number of common values, the visitor first has to prove they are human (by solving the Captcha), and only then is their username and password submission checked against the authentication data store.

Also, if they enter an invalid username + password combination three times, they have to solve the Captcha again. This prevents attempts in which the attacker would first solve the Captcha themselves, and then let a bot brute-force the authentication info.

Default Source Code Folder Online Source
C:\Program Files\Lanapsoft\BotDetect 3 CAPTCHA Component\Asp\WebApp\AspLoginCaptchaSample

ASP jQuery Validation CAPTCHA Code Sample

This code sample shows how to integrate BotDetect ASP Classic Captcha validation with jQuery Validation client-side form validation.

Client-side validation is not secure by itself (it can be bypassed trivially by bots that don't execute JavaScript at all), so the sample shows how the protected form action must always be secured by server-side Captcha validation first, and uses client-side validation only to improve the user experience.

Default Source Code Folder Online Source
C:\Program Files\Lanapsoft\BotDetect 3 CAPTCHA Component\Asp\WebApp\AspJQueryValidationCaptchaSample

ASP Built-In Ajax CAPTCHA Validation Code Sample

This code sample shows how to properly perform Ajax Captcha validation using built-in BotDetect client-side functionality, which doesn't require any 3rd party Ajax frameworks.

It uses the Captcha Form Sample as a starting point, and adds client-side validation of all form fields.

Ajax Captcha validation improves the user experience by reducing Captcha validation response time, giving users much faster feedback about the validation result.

Default Source Code Folder Online Source
C:\Program Files\Lanapsoft\BotDetect 3 CAPTCHA Component\Asp\WebApp\CaptchaAjaxValidationSample

ASP Multiple CAPTCHAs Code Sample

This code sample shows how to have multiple Captcha-protected pages within the same ASP application.

As long as the Captcha instances have different names ("Captcha1" and "Captcha2" in the sample), they can have completely separate settings and won't interfere with each other's validation.

Even if a user opens the same page in multiple browser tabs, each tab will properly validate the shown Captcha code.

Default Source Code Folder Online Source
C:\Program Files\Lanapsoft\BotDetect 3 CAPTCHA Component\Asp\WebApp\AspMultipleCaptchasSample

BotDetect ASP CAPTCHA Configuration Code Samples

Captcha configuration code samples code samples show how to use particular BotDetect Captcha options in your Classic ASP applications

ASP Captcha Code Filtering Code Sample

This code sample shows how to use the new Captcha code filtering functionality added in BotDetect 3.0.

You can define rules about character sequences you want to avoid using in randomly generated Captcha codes and simply pass them to the Captcha control.

The BotDetect/CaptchaConfig.asp file defines a simplified custom character set (using only 'A', 'B', 'C' and 'D'), which helps make the code filtering easier to track in action.

The LBD_Configured_BannedSequences setting in the same file shows how to create your own banned sequence definitions to suit your application needs. The following sequences will never appear in Captcha codes generated in the sample: D, AA, BB, CC, ABC, BCA, CAB.

Default Source Code Folder Online Source
C:\Program Files\Lanapsoft\BotDetect 3 CAPTCHA Component\Asp\WebApp\CaptchaCodeFilteringSample

ASP Captcha Customization Code Sample

This code sample shows how to customize BotDetect Captcha behavior and appearance.

BotDetect 3.0 allows user-defined customization of many Captcha options through a special BotDetect\CaptchaConfig.asp configuration file; some customizations also require page source changes.

The BotDetect\CaptchaConfig.asp file used in this code sample contains detailed descriptions and explanations of the many customizable options.

You can then use chosen customization options to configure BotDetect to precisely match your application requirements.

Default Source Code Folder Online Source
C:\Program Files\Lanapsoft\BotDetect 3 CAPTCHA Component\Asp\WebApp\CaptchaCustomizationSample

ASP Captcha Randomization Code Sample

This code sample shows how to easily randomize various Captcha control parameters, beyond the basic image and sound style randomization used by default.

Randomly using different Captcha image and sound generation algorithms and other parameter values (such as code length and style) can significantly improve the Captcha security.

This is the recommended approach to Captcha property setting, since it takes full advantage of the 60 Captcha image and 10 Captcha sound generation algorithms shipped with BotDetect, as well as built-in randomization features.

Default Source Code Folder Online Source
C:\Program Files\Lanapsoft\BotDetect 3 CAPTCHA Component\Asp\WebApp\CaptchaRandomizationSample

BotDetect ASP CAPTCHA Troubleshooting Code Samples

Captcha troubleshooting code samples show how to troubleshoot Captcha issues that might arise in your Classic ASP applications

ASP Captcha Built-In Troubleshooting Code Sample

This code sample shows how to use the BotDetect Troubleshooting helper to debug Captcha issues.

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

Default Source Code Folder Online Source
C:\Program Files\Lanapsoft\BotDetect 3 CAPTCHA Component\Asp\WebApp\CaptchaTroubleshootingSample

Please Note

The information on this page is out of date and applies to a deprecated version of BotDetect™ CAPTCHA (v3.0).

An up-to-date equivalent page for the latest BotDetect Captcha release (v4) is BotDetect v4 Captcha documentation index.

General information about the major improvements in the current BotDetect release can be found at the What's New in BotDetect v4.0 page.