Lanap.BotDetect.CodeTypeEnum Reference

Lanap.BotDetect.CodeTypeEnum 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.

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
letter
about