BotDetect ASP.NET CAPTCHA Core API Reference (BotDetect v3.0; deprecated)
While the BotDetect.Web members are used for Captcha control functionality within a Web context, the root BotDetect ASP.NET Captcha namespace contains members related to general Captcha functionality, independent of the context it's used for.
- BotDetect.CaptchaBase class
- BotDetect.Code class
- BotDetect.CodeCollection class
- BotDetect.BannedCharacterSequences class
- BotDetect.CaptchaRandomization class
- BotDetect.StringHelper class
BotDetect.CaptchaBase
A base Captcha object, representing a generic Captcha instance capable of generating Captcha codes, images and sounds + validating user inputs. The CaptchaControl instances tailored for System.Web use all delegate core Captcha functionality to a contained CaptchaBase instance.
Also, if you were for example implementing a Captcha class tailored for Windows Forms applications, you would implement a CaptchaWinFormControl class, which would implement desktop context-specific functionality and delegate Captcha functionality to a contained CaptchaBase instance.
BotDetect.CaptchaBase Class Reference | ||
---|---|---|
CaptchaBase
|
Captcha identifier, distinguishing multiple Captcha instances within the system. Each Captcha used in a different location (web page or Windows Form or mobile screen) must have a unique identifier | |
string GetCode
|
Generates a random Captcha code for the given purpose, using settings stored in instance data belonging to the specified instanceId | |
System.IO.MemoryStream GetImage
|
Generates a Captcha image, using settings stored in instance data belonging to the specified instanceId | |
System.IO.MemoryStream GetSound
|
Generates a Captcha sound, using settings stored in instance data belonging to the specified instanceId | |
bool Validate
|
Compares the user input to the Captcha code stored for the given instanceId, using validation rules specified for the current ValidationAttemptOrigin | |
string CaptchaId | Captcha identifier, distinguishing multiple Captcha instances within the system. Can also be accessed through this property, after being initialized in the constructor | |
string Locale | Locale string, affects the character set used for Captcha code generation and the pronunciation language used for Captcha sound generation | |
int CodeLength | Length (number of characters) of the Captcha code rendered; the default value is 5 | |
BotDetect.CodeStyle CodeStyle | Code style, i.e. the algorithm used to generate Captcha codes; the default value is Alphanumeric | |
string CustomCharacterSetName | Optional name of the user-defined character set used for Captcha code generation. A collection of custom character sets can be defined in the currently used Captcha configuration provider | |
BotDetect.ImageStyle ImageStyle | Image style, i.e. the algorithm used to render Captcha codes in images; if no image style is set, it is randomized by default | |
BotDetect.ImageFormat ImageFormat | Image format in which the Captcha image will be rendered; the default format is JPEG | |
BotDetect.Drawing.Color CustomDarkColor | Optional custom dark color point, modifies the color palette used for Captcha image drawing | |
BotDetect.Drawing.Color CustomLightColor | Optional custom light color point, modifies the color palette used for Captcha image drawing | |
BotDetect.SoundStyle SoundStyle | Sound style, i.e. the algorithm used to pronounce Captcha codes in sounds; the default image style is Dispatch | |
BotDetect.SoundFormat SoundFormat | Audio format in which the Captcha sound will be generated; the default format is WawPcm16bit8kHzMono | |
BotDetect.SoundRegenerationMode SoundRegenerationMode | Sound regeneration mode determining how will multiple consecutive requests for audio Captcha with the same Captcha code be handled by BotDetect; the default mode is |
|
readonly string InstanceId | Globally unique identifier of the current CaptchaBase object instance | |
readonly bool IsLocalized PronunciationAvailable | Is the BotDetect pronunciation sound package for the currently used locale available | |
static void RegisterGenerating CaptchaCodeHandler
|
Propagate GeneratingCaptchaCode event handlers registered in delegating classes to the global event delegate | |
static void RegisterGenerated CaptchaCodeHandler
|
Propagate GeneratedCaptchaCode event handlers registered in delegating classes to the global event delegate | |
static void RegisterGenerating CaptchaImageHandler
|
Propagate GeneratingCaptchaImage event handlers registered in delegating classes to the global event delegate | |
static void RegisterGenerated CaptchaImageHandler
|
Propagate GeneratedCaptchaImage event handlers registered in delegating classes to the global event delegate | |
static void RegisterGenerating CaptchaSoundHandler
|
Propagate GeneratingCaptchaSound event handlers registered in delegating classes to the global event delegate | |
static void RegisterGenerated CaptchaSoundHandler
|
Propagate GeneratedCaptchaSound event handlers registered in delegating classes to the global event delegate | |
static void RegisterValidating UserInputHandler
|
Propagate ValidatingUserInput event handlers registered in delegating classes to the global event delegate | |
static void RegisterValidated UserInputHandler
|
Propagate ValidatedUserInput event handlers registered in delegating classes to the global event delegate | |
static BotDetect. BannedCharacterSequences BannedCharacterSequences | Optional global list of sequences which will be filtered out of the randomly generated Captcha codes, used for example for swear-word filtering. The BannedCharacterSequences object is created from the string values passed by the delegating classes | |
static readonly System.Text. RegularExpressions.Regex ValidCaptchaId | The global regular expression object used to validate CaptchaId values and ensure they match the persistence medium key limitations |
BotDetect.Code
Represents a single randomly generated Captcha code.
BotDetect.Code Class Reference | ||
---|---|---|
Code
|
The constructor takes the freshly generated random Captcha code that will be contained in the object | |
bool IsUsedForSoundGeneration | Has the Captcha code been used to generate a Captcha sound | |
bool IsUsedForImageGeneration | Has the Captcha code been used to generate a Captcha image | |
readonly string CaptchaCode | The random Captcha code contained in the object | |
readonly System.DateTime GenerationTime | When was the random Captcha code generated | |
readonly int ElapsedSeconds | How many seconds have elapsed since the random Captcha code was generated |
BotDetect.CodeCollection
Represents a collection of Captcha codes generated for a particular Captcha instance (identified by captchaId) in the current applications.
Implements
System.Collections.Generic.IEnumerable<BotDetect.Code>, System.Collections.IEnumerable
BotDetect.CodeCollection Class Reference | ||
---|---|---|
CodeCollection | The default CodeCollection constructor takes no arguments | |
public IEnumerator <BotDetect.Code> GetEnumerator | Allows enumerating the contained Code instances | |
string GetCode
|
Given the Captcha instance identifier and Captcha code purpose, returns an existing Captcha code if a valid one exists, or creates a new one automatically | |
void SaveCode
|
Stores a Code object in the collection | |
bool Validate
|
Compares the user input to stored values matching the criteria | |
readonly int Count | How many Code instances are contained in the collection | |
readonly static int CodeTimeout | The currently configured timeout used to invalidate Captcha codes after a certain period of time |
BotDetect.BannedCharacterSequences
Represents a collection of banned character sequences that will be excluded from all randomly generated Captcha codes.
BotDetect.BannedCharacterSequences Class Reference | ||
---|---|---|
BannedCharacterSequences
|
The default BannedCharacterSequences constructor takes a list of banned sequences as simple strings | |
BotDetect.Set<int> GetBannedCharacters | Returns the full set of individual banned Unicode code points (which can also be specified this way) | |
BotDetect.Set<int> GetBannedCharacters
|
Returns the set of possible Unicode code points that must not be used to randomly choose the next character, given the current already generated character sequence |
BotDetect.CaptchaRandomization
A helper class used for easy randomization of Captcha parameters.
BotDetect.CaptchaRandomization Class Reference | ||
---|---|---|
static int GetRandomCodeLength | Returns a random Captcha code length, using default code length bounds | |
static int GetRandomCodeLength
|
Returns a random Captcha code length, using the default minimal value and the specified maximal value | |
static int GetRandomCodeLength
|
Returns a random Captcha code length, using the specified minimal and maximal values | |
static BotDetect.CodeStyle GetRandomCodeStyle
|
Returns a random Captcha code style. Selects from all available styles if no parameter is specified, or from the given value set if specified | |
static BotDetect.ImageStyle GetRandomImageStyle
|
Returns a random Captcha image style. Selects from all available styles if no parameter is specified, or from the given value set if specified | |
static BotDetect.SoundStyle GetRandomSoundStyle
|
Returns a random Captcha sound style. Selects from all available styles if no parameter is specified, or from the given value set if specified |
BotDetect.StringHelper
A helper class used for common string operations used by BotDetect code.
BotDetect.StringHelper Class Reference | ||
---|---|---|
static bool HasValue
|
Checks that the suppliedstring is not null, empty, or consists of only whitespace characters | |
static string[] CsvToArray
|
Splits the supplied comma-separated input into a string array | |
static BotDetect.Set<int> GetCodePoints
|
Converts the given collection of characters into Unicode code points | |
static System.Collections. Specialized.StringCollection ParseCsv
|
Splits the supplied comma-separated input into a character collection | |
static string LogFriendly
|
Writes the given input to a log-friendly string | |
static string LogFriendly
|
Writes the given input to a log-friendly string | |
static string LogFriendly
|
Writes the given input to a log-friendly string | |
static string ToString
|
Writes the given input to a log-friendly string | |
static string ToString
|
Writes the given input to a log-friendly string | |
static System.Text.StringBuilder LogFriendlyWrite
|
Writes the given input to the StringBuilder instance in a log-friendly format |
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.
Current BotDetect Versions
-
BotDetect ASP.NET CAPTCHA
2019-07-22v4.4.2 -
BotDetect Java CAPTCHA
2019-07-22v4.0.Beta3.7 -
BotDetect PHP CAPTCHA
2019-07-22v4.2.5