BotDetect ASP.NET CAPTCHA Web MVC API Reference
The BotDetet.Web.UI.Mvc encapsulates BotDetect ASP.NET Captcha types specific to ASP.NET MVC Captcha implementations. It's separated from the main BotDetect assembly into BotDetect.Web.UI.Mvc.dll so referencing BotDetect doesn't cause a dependency on ASP.NET MVC, unless BotDetect.Web.UI.Mvc.dll is also referenced.
- BotDetect.Web.UI.Mvc.MvcCaptcha class
- BotDetect.Web.UI.Mvc.CaptchaValidationAttribute class
- System.Web.Mvc.CaptchaHtmlHelper class
BotDetect.Web.UI.Mvc.MvcCaptcha
A BotDetect Captcha control variant used for ASP.NET MVC applications.
| BotDetect.Web.UI.Mvc.MvcCaptcha Class Reference | ||
|---|---|---|
![]() |
MvcCaptcha
|
The constructor takes a unique identifier of the Captcha control within the application (for example, if you placed one Captcha control on the Registration page and another on the Contact Us, they should have distinct CaptchaId values) |
![]() |
bool Validate
|
Compares the given user input with the Captcha code stored on the server for the specified instanceId |
![]() |
void SaveSettings | Saves Captcha settings to the Captcha persistence provider. Has to be called explicitly in ASP.NET MVC applications, since there is no equivalent of the Page_PreRender event in which this can be done automatically |
![]() |
void Reset | Resets the IsSolved status of the current Captcha instance |
![]() |
string UserInputClientID | User input textbox client-side identifier (the ASP.NET ClientID property), used for all client-side user input processing, e.g. automatic user input lowercasing and focusing |
![]() |
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 <botDetect> section of the web.config file |
![]() |
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 |
![]() |
System.Drawing.Size ImageSize | Size of the Captcha image rendered; the default size is (250, 50) |
![]() |
BotDetect.ImageFormat ImageFormat | Image format in which the Captcha image will be rendered; the default format is JPEG |
![]() |
System.Drawing.Color CustomDarkColor | Optional custom dark color point, modifies the color palette used for Captcha image drawing |
![]() |
System.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; if no sound style is set, it is randomized by default |
![]() |
BotDetect.SoundFormat SoundFormat | Audio format in which the Captcha sound will be generated; the default format is WawPcm16bit8kHzMono |
![]() |
bool UseHorizontalIcons | By default, tells is the selected Captcha image height so low that we should switch to horizontal icon rendering; can be user-specified to always (or never) switch to the horizontal icon layout |
![]() |
bool UseSmallIcons | By default, tells is the selected Captcha image height so low that we should switch to smaller icons; can be user-specified to always (or never) use small icons |
![]() |
int IconsDivWidth | Calculated width of the Captcha icons <div>, can be user-set to create custom icon layouts |
![]() |
short TabIndex | Starting tabindex for the Captcha control Html output. There are three keyboard-selectable Captcha markup elements: the Captcha image help link, the Captcha sound icon and the Captcha reload icon. Depending on your settings (whether the Captcha help link is enabled, are Captcha sounds enabled, is Captcha reloading enabled), the next available tabindex on the page can be from 0 to 3 greater than this value. |
![]() |
readonly BotDetect.Web. CaptchaControl CaptchaControl | Underlying CaptchaControl instance used by the current Captcha instance. The MvcCaptcha control delegates much of it's Captcha functionality to the abstract CaptchaControl instance |
![]() |
readonly string CaptchaId | Unique identifier of the Captcha control within the application (for example, if you placed one Captcha control on the Registration page and another on the Contact Us, they would have distinct CaptchaId values) |
![]() |
readonly bool IsSolved | Has the current Captcha instance been successfully solved already |
![]() |
readonly string CurrentInstanceId | Globally unique identifier of the current Captcha object instance, used to ensure each page load keeps separate Captcha codes, for example when opening the same form in multiple browser tabs |
![]() |
EventHandler <InitializedCaptcha ControlEventArgs> InitializedCaptchaControl | Custom event handler delegate for InitializedCaptchaControl events, most commonly used for Captcha property randomization |
![]() |
EventHandler <GeneratingCaptcha CodeEventArgs> GeneratingCaptchaCode | Custom event handler delegate for GeneratingCaptchaCode events, which occur before each Captcha code is generated |
![]() |
EventHandler <GeneratedCaptcha CodeEventArgs> GeneratedCaptchaCode | Custom event handler delegate for GeneratedCaptchaCode events, which occur after each Captcha code has been generated |
![]() |
EventHandler <GeneratingCaptcha ImageEventArgs> GeneratingCaptchaImage | Custom event handler delegate for GeneratingCaptchaImage events, which occur before each Captcha image is generated |
![]() |
EventHandler <GeneratedCaptcha ImageEventArgs> GeneratedCaptchaImage | Custom event handler delegate for GeneratedCaptchaImage events, which occur after each Captcha image has been generated |
![]() |
EventHandler <GeneratingCaptcha SoundEventArgs> GeneratingCaptchaSound | Custom event handler delegate for GeneratingCaptchaSound events, which occur before each Captcha sound is generated |
![]() |
EventHandler <GeneratedCaptcha SoundEventArgs> GeneratedCaptchaSound | Custom event handler delegate for GeneratedCaptchaSound events, which occur after each Captcha sound has been generated |
![]() |
EventHandler <ValidatingUser InputEventArgs> ValidatingUserInput | Custom event handler delegate for ValidatingUserInput events, which occur before each user input is generated |
![]() |
EventHandler <ValidatedUser InputEventArgs> ValidatedUserInput | Custom event handler delegate for ValidatedUserInput events, which occur after each user input has been generated |
![]() |
static System.Collections. Generic.List<string> BannedSequences | Optional global list of sequences which will be filtered out of the randomly generated Captcha codes, used for example for swear-word filtering |
BotDetect.Web.UI.Mvc.CaptchaValidationAttribute
An ActionFilterAttribute sub-class setting RouteData depending on the Captcha validation result.
Inherits
System.Web.Mvc.ActionFilterAttribute
| BotDetect.Web.UI.Mvc.CaptchaValidationAttribute Class Reference | ||
|---|---|---|
![]() |
CaptchaValidationAttribute
|
The default constructor takes identifiers of the Captcha code user input textbox and the Captcha control |
![]() |
void OnActionExecuting
|
ActionFilterAttribute override, validating the submitted Captcha code input and setting RouteData accordingly |
System.Web.Mvc.CaptchaHtmlHelper
A HtmlHelper extension used for generating Captcha markup.
| System.Web.Mvc.CaptchaHtmlHelper Class Reference | ||
|---|---|---|
![]() |
static string Captcha
|
Generates Html markup for the given MvcCaptcha control instance |
Current BotDetect Versions
- BotDetect PHP CAPTCHA v3.0.Alpha12012–02–06
- BotDetect ASP.NET CAPTCHA v3.0.92011–11–21
- BotDetect ASP Classic CAPTCHA v3.0.92011–11–21











