Lanap.BotDetect.CodeTypeEnum Reference (BotDetect v2.0; deprecated)

Please Note

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

An up-to-date equivalent page for the latest BotDetect Captcha release (v3) is BotDetect v3 ASP.NET Captcha API reference.

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

Lanap.BotDetect.CodeTypeEnum is a member of the BotDetect ASP.NET CAPTCHA interface that contains all valid values of the Lanap.BotDetect.Captcha control's CodeType property. It represents the type of code rendered in CAPTCHA images and spoken in the audio CAPTCHAs.

Table of Contents

Members

[VB.NET]

Public Enum CodeTypeEnum
  Alpha = 0
  Numeric
  AlphaNumeric
End Enum
[C#]

public enum CodeTypeEnum
{
  Alpha = 0,
  Numeric,
  AlphaNumeric
}

Default value

If the CodeType property is not set, CodeTypeEnum.AlphaNumeric is used by default.

Usage

[VB.NET]

' Example 1: simple assignment
SampleCaptcha.CodeType = CodeTypeEnum.Alpha

' Example 2: basic randomization
Dim max As Integer = _ 
  System.Enum.GetValues(GetType(CodeTypeEnum)).Length
SampleCaptcha.CodeType = CType(rand.Next(max), CodeTypeEnum)

' the above assumes a global RNG is initialized as follows: 
Public Shared ReadOnly rand As Random = New Random()

' Example 3: basic randomization using RandomizationHelper.vb
SampleCaptcha.CodeType = RandomizationHelper.GetRandomCodeType()

' Example 4: advanced randomization using RandomizationHelper.vb
Dim types As CodeTypeEnum() = { _
  CodeTypeEnum.Alpha, _
  CodeTypeEnum.Numeric _
}

SampleCaptcha.CodeType = _
  RandomizationHelper.GetRandomCodeType(types)
[C#]

// Example 1: simple assignment
SampleCaptcha.CodeType = CodeTypeEnum.Alpha;

// Example 2: basic randomization
int max = Enum.GetValues(typeof(CodeTypeEnum)).Length;
SampleCaptcha.CodeType = (CodeTypeEnum)(rand.Next(max));

// the above assumes a global RNG is initialized as follows: 
public static readonly Random rand = new Random();

// Example 3: basic randomization using RandomizationHelper.cs
SampleCaptcha.CodeType = RandomizationHelper.GetRandomCodeType();

// Example 4: advanced randomization using RandomizationHelper.cs
CodeTypeEnum[] types = { 
  CodeTypeEnum.Alpha, 
  CodeTypeEnum.Numeric
};

SampleCaptcha.CodeType = 
  RandomizationHelper.GetRandomCodeType(types)

Notes

To improve user-friendliness, the CodeTypeEnum.AlphaNumeric code generation algorithm doesn't use the full range of available characters, but excludes some easily confused character pairs - for example, '1', 'I', '7', 'L', '0', 'O', '5' and 'S' are not used.

Screenshots

(Using the "Strippy" Text Style)

Alpha

BotDetect CAPTCHA Alpha CodeType Example BotDetect CAPTCHA Alpha CodeType Example

Numeric

BotDetect CAPTCHA Numeric CodeType Example BotDetect CAPTCHA Numeric CodeType Example

AlphaNumeric

BotDetect CAPTCHA AlphaNumeric CodeType Example BotDetect CAPTCHA AlphaNumeric CodeType Example

Please Note

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

An up-to-date equivalent page for the latest BotDetect Captcha release (v3) is BotDetect v3 ASP.NET Captcha API reference.

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