Skip to main content
Tab

ASPxCaptcha Class

A control used for the challenge-response authentication.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public class ASPxCaptcha :
    ASPxWebControl,
    IRequiresLoadPostDataControl

Remarks

The ASPxCaptcha class implements the functionality of a challenge-response authentication test, which enables verifying that submitted data came from a human, and not a robot or script.

ASPxCaptcha-Class

Create a Captcha Control

Design Time

The ASPxCaptcha control is available on the DX.24.1: Common Controls toolbox tab in the Microsoft Visual Studio IDE.

Drag the control onto a form and customize the control’s settings, or paste the control’s markup in the page’s source code.

<dx:ASPxCaptcha ID="Captcha" runat="server" ClientInstanceName="ClientCaptcha">
    <TextBox Position="Bottom" />
    <ValidationSettings SetFocusOnError="true" ErrorDisplayMode="ImageWithText" />
</dx:ASPxCaptcha>

Run Time

using DevExpress.Web;
...
protected void Page_Load(object sender, EventArgs e)
{
    ASPxCaptcha captcha = new ASPxCaptcha();
    captcha.ID = "Captcha";
    Page.Form.Controls.Add(captcha);

    captcha.ClientInstanceName = "ClientCaptcha";
    captcha.TextBox.Position = DevExpress.Web.Captcha.ControlPosition.Bottom;
    captcha.ValidationSettings.SetFocusOnError = true;
    captcha.ValidationSettings.ErrorDisplayMode = ErrorDisplayMode.ImageWithText;
}

Note

DevExpress controls require that you register special modules, handlers, and options in the Web.config file. You can change this file or switch to the Design tab in the Microsoft Visual Studio IDE to automatically update the Web.config file. Note that this information is automatically registered if you use the DevExpress Template Gallery to create a project.

The ASPxCaptcha control uses a session state to store a verification code. Therefore, the session state mode attribute should not be Off for the control to operate properly.

The control consists of the following elements:

Note

The ASPxCaptcha control provides you with comprehensive client-side functionality, implemented using JavaScript code:

The control’s client-side API is enabled if the ASPxCaptcha.ClientInstanceName property is defined, or any client event is handled.

See Also