BotDetect ASP.NET WebPages CAPTCHA Integration Quickstart

1. Add a Reference to BotDetect and SQLite

The BotDetect.dll assembly should be referenced. They are included in the BotDetect installation.

By default, BotDetect ASP.NET CAPTCHA Simple API uses SQLite as the default persistence provider for storing captcha data, so you need to ensure SQLite assembly is referenced in your project. Here is where you can find the SQLite installation guide. Or check any Simple API examples that are installed with BotDetect.

2. Show a Captcha Challenge on the Form

Import the BotDetect namespace, include BotDetect styles in page <head>, create a SimpleCaptcha object and pass it to the SimpleCaptcha HtmlHelper:
@using BotDetect.Web; 
    SimpleCaptcha exampleCaptcha = new SimpleCaptcha("ExampleCaptcha");

3. Check User Input During Form Submission

When the form is submitted, the SimpleCaptcha validation result must be checked:
  @if ((Request.HttpMethod == "POST"))
    bool isHuman = exampleCaptcha.Validate();
    if (isHuman)
      <span class="correct">Correct!</span>
      <span class="incorrect">Incorrect!</span>

4. Configure Your ASP.NET Application

Update your application configuration (the web.config file):
    <!-- Register the HttpHandler used for BotDetect Simple API 
      requests -->
    <add verb="GET" path="BotDetectCaptcha.ashx"
      type="BotDetect.Web.SimpleCaptchaHandler, BotDetect"/>

  <validation validateIntegratedModeConfiguration="false"/>
    <!-- Register the HttpHandler used for BotDetect Simple API 
      requests (IIS 7.0+) -->
    <remove name="BotDetectCaptchaHandler"/>
    <add name="BotDetectCaptchaHandler" preCondition="integratedMode" 
      verb="GET" path="BotDetectCaptcha.ashx"
      type="BotDetect.Web.SimpleCaptchaHandler, BotDetect"/>

5. Configure Captcha options

Configure captcha options in botdetect.xml configuration file. By default, this file is located at the root of your project.

<?xml version="1.0" encoding="UTF-8"?>
<botdetect xmlns=""



Other BotDetect ASP.NET CAPTCHA Quickstarts