New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

This control serves as spam protection mechanism. It implements 3 strategies:

  1. Auto-detection - if this strategy is chosen, then we use predefined rules

which decide whether the input comes from a robot or not. This strategy is not 100% secure and some sophisticated robots may pass it so it should be used in personal websites with low traffic and where spam robots are not very likely to drop by. If such robots are found to visit the site, the use of the more secure strategy is more advisable. 2. RadCaptcha - if this strategy is chosen, then an image with obfuscated text is displayed and the user is required to input this text in a textbox thus allowing the control to validate whether s/he is a robot or not. This is the most secure method to protect from spam but it is considered to be inaccessible because disabled people may not see the text in the image! TODO in future release: 3. Subscribe to anti-spam services. This last spam protection mechanism is used to validate the input against public or private web services which given the input return whether or not it is considered to be spam. Some services claim that they catch more than 90% of the spam so this type of protection is fairly secure and can be used in small to medium websites but not in large-scale websites.

Definition

Namespace:Telerik.Web.UI

Assembly:Telerik.Web.UI.dll

Syntax:

C#
[ClientScriptResource("Telerik.Web.UI.RadCaptcha", "Telerik.Web.UI.Captcha.RadCaptcha.js")]
[TelerikToolboxCategory("Miscellaneous")]
[ToolboxBitmap(typeof(RadCaptcha), "Toolbox.Icons.Captcha.png")]
public class RadCaptcha : RadWebControl, IComponent, IDisposable, IParserAccessor, IUrlResolutionService, IDataBindingsAccessor, IControlBuilderAccessor, IControlDesignerAccessor, IExpressionsAccessor, IAttributeAccessor, IScriptControl, IControlResolver, ISkinnableControl, IControl, IValidator, INamingContainer, IPostBackDataHandler

Inheritance: objectControlWebControlRadWebControlRadCaptcha

Implements: IAttributeAccessorIComponentIControlIControlBuilderAccessorIControlDesignerAccessorIControlResolverIDataBindingsAccessorIDisposableIExpressionsAccessorINamingContainerIParserAccessorIPostBackDataHandlerIScriptControlISkinnableControlIUrlResolutionServiceIValidator...

Inherited Members WebControl.AddAttributesToRender(HtmlTextWriter)WebControl.ApplyStyle(Style)WebControl.CopyBaseAttributes(WebControl)WebControl.CreateControlStyle()WebControl.LoadViewState(object)WebControl.TrackViewState()WebControl.MergeStyle(Style)WebControl.Render(HtmlTextWriter)WebControl.RenderBeginTag(HtmlTextWriter)WebControl.RenderEndTag(HtmlTextWriter)WebControl.RenderContents(HtmlTextWriter)WebControl.SaveViewState()WebControl.AttributesWebControl.BackColorWebControl.BorderColorWebControl.BorderWidthWebControl.BorderStyleWebControl.ControlStyleWebControl.ControlStyleCreatedWebControl.CssClassWebControl.DisabledCssClassWebControl.StyleWebControl.EnableThemingWebControl.FontWebControl.HasAttributesWebControl.HeightWebControl.IsEnabledWebControl.SupportsDisabledAttributeWebControl.SkinIDWebControl.TagKeyWebControl.TagNameWebControl.ToolTipWebControl.WidthControl.ResolveAdapter()Control.HasEvents()Control.GetRouteUrl(object)Control.GetRouteUrl(string, object)Control.GetRouteUrl(RouteValueDictionary)Control.GetRouteUrl(string, RouteValueDictionary)Control.GetUniqueIDRelativeTo(Control)Control.ApplyStyleSheetSkin(Page)Control.OnDataBinding(EventArgs)Control.DataBind()Control.DataBind(bool)Control.DataBindChildren()Control.AddParsedSubObject(object)Control.EnsureID()Control.OnInit(EventArgs)Control.ClearChildState()Control.ClearChildControlState()Control.ClearChildViewState()Control.ClearEffectiveClientIDMode()Control.ClearCachedClientID()Control.Focus()Control.LoadControlState(object)Control.MapPathSecure(string)Control.OpenFile(string)Control.OnLoad(EventArgs)Control.OnPreRender(EventArgs)Control.BuildProfileTree(string, bool)Control.SaveControlState()Control.RenderChildren(HtmlTextWriter)Control.RenderControl(HtmlTextWriter)Control.RenderControl(HtmlTextWriter, ControlAdapter)Control.OnUnload(EventArgs)Control.Dispose()Control.RaiseBubbleEvent(object, EventArgs)Control.OnBubbleEvent(object, EventArgs)Control.AddedControl(Control, int)Control.CreateControlCollection()Control.CreateChildControls()Control.ResolveUrl(string)Control.ResolveClientUrl(string)Control.FindControl(string)Control.FindControl(string, int)Control.GetDesignModeState()Control.HasControls()Control.IsLiteralContent()Control.EnsureChildControls()Control.RemovedControl(Control)Control.SetDesignModeState(IDictionary)Control.SetRenderMethodDelegate(RenderMethod)Control.ClientIDModeControl.ClientIDControl.ClientIDSeparatorControl.ContextControl.AdapterControl.DesignModeControl.EventsControl.IDControl.IsChildControlStateClearedControl.EnableViewStateControl.ViewStateModeControl.IsViewStateEnabledControl.NamingContainerControl.IdSeparatorControl.LoadViewStateByIDControl.PageControl.RenderingCompatibilityControl.TemplateControlControl.ParentControl.TemplateSourceDirectoryControl.AppRelativeTemplateSourceDirectoryControl.SiteControl.VisibleControl.UniqueIDControl.HasChildViewStateControl.ControlsControl.ValidateRequestModeControl.ViewStateControl.ViewStateIgnoresCaseControl.ChildControlsCreatedControl.IsTrackingViewStateControl.DisposedControl.DataBindingControl.InitControl.LoadControl.PreRenderControl.Unloadobject.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()...

Constructors

C#
public RadCaptcha()

Properties

Gets or sets the RadCaptcha text box access key.

C#
public override string AccessKey { get; set; }
Property Value:

The RadCaptcha text box access key.

Overrides: RadWebControl.AccessKey

Gets or sets the access key for the Get Audio Code link.

C#
public string AudioAccessKey { get; set; }

Gets or sets the text of the LinkButton that gets the Captcha Audio Code.

C#
public string CaptchaAudioLinkButtonText { get; set; }
Property Value:

Gets or sets the text of the LinkButton that gets the Captcha Audio Code.

Gets the CaptchaImage object of RadCaptcha

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public CaptchaImage CaptchaImage { get; }

Gets or sets the text of the LinkButton that generates new CaptchaImage.

C#
public string CaptchaLinkButtonText { get; set; }
Property Value:

Gets or sets the text of the LinkButton that generates new CaptchaImage

Gets or sets the maximum number of minutes RadCaptcha will be cached and valid. If you're too slow, you may be a RadCaptcha hack attempt. Set to zero to disable.

C#
public int CaptchaMaxTimeout { get; set; }
Property Value:

The maximum number of minutes RadCaptcha will be cached and valid. If you're too slow, you may be a RadCaptcha hack attempt. Set to zero to disable.

Gets or sets the CSS class applied to the RadCaptcha input textbox.

C#
[Obsolete("This property is obsolete. Please use the new composite TextBoxDecoration property.")]
public string CaptchaTextBoxCssClass { get; set; }
Property Value:

The CSS class applied to the RadCaptcha input textbox.

Gets or sets the label which explains that the user needs to input the RadCaptcha text box.

C#
public string CaptchaTextBoxLabel { get; set; }
Property Value:

The label which explains that the user needs to input the RadCaptcha text box.

Gets or sets the CSS class to the label which explains that the user needs to input the RadCaptcha text box.

C#
[Obsolete("This property is obsolete. Please use the new composite TextBoxLabelDecoration property.")]
public string CaptchaTextBoxLabelCssClass { get; set; }
Property Value:

The CSS class to the label which explains that the user needs to input the RadCaptcha text box.

Gets or sets the title of the RadCaptcha input textbox.

C#
[Obsolete("This property is obsolete. Please use the new composite TextBoxDecoration property.")]
public string CaptchaTextBoxTitle { get; set; }
Property Value:

The title for the RadCaptcha input textbox.

Gets or sets display behavior of error message.

C#
public ValidatorDisplay Display { get; set; }

Gets or sets the text displayed in the Download Audio Code link.

C#
public string DownloadAudioText { get; set; }

Gets or sets a value indicating whether the Web server control is enabled.

C#
public bool Enabled { get; set; }

Defines whether Download Audio Code link should be rendered.

C#
[ClientControlProperty]
[ClientPropertyName("_enableDownloadAudio")]
public bool EnableDownloadAudio { get; set; }

Gets or sets the value, indicating whether to render the link to the embedded base stylesheet of the control or not. This control features no skins, so this property must be set to false.

C#
[Browsable(false)]
public override bool EnableEmbeddedBaseStylesheet { get; }

Overrides: RadWebControl.EnableEmbeddedBaseStylesheet

Gets or sets the value, indicating whether to render links to the embedded skins or not. This control features no skins, so this property must be set to false.

C#
[Browsable(false)]
public override bool EnableEmbeddedSkins { get; }

Overrides: RadWebControl.EnableEmbeddedSkins

Defines whether notification panel for missing audio plug-in should be displayed if one is not installed on the client's machine.

C#
[ClientControlProperty]
[ClientPropertyName("_enableMissingPluginNotification")]
public bool EnableMissingPluginNotification { get; set; }

Gets or sets a bool value indicating whether or not the RadCaptchaImage can be refreshed. The "rcRefreshImage" CSS class should be used for changing the skinning of the LinkButton, that generates the new image.

C#
public bool EnableRefreshImage { get; set; }
Property Value:

Gets or sets a bool value indicating whether or not the RadCaptchaImage can be refreshed.

The error message text generated when the condition being validated fails.

C#
[Bindable(true)]
public string ErrorMessage { get; set; }

Implements: IValidator.ErrorMessage

Gets or sets the fore color of the error message.

C#
public override Color ForeColor { get; set; }

Overrides: RadWebControl.ForeColor

Specifies the URL of the HTTPHandler that serves the captcha image.

C#
public string HttpHandlerUrl { get; set; }

The HTTPHandler should either be registered in the application configuration file, or a file with the specified name should exist at the location, which HttpHandlerUrl points to.

If a file is to serve the files, it should inherit the class Telerik.Web.UI.WebResource

Gets or sets a bool value indicating whether the RadCaptcha should ignore the case of the letters or not.

C#
public bool IgnoreCase { get; set; }
Property Value:

Bool value indicating whether the RadCaptcha should ignore the case or not.

Gets or sets the storage medium for the CaptchaImage.

C#
public CaptchaImageStorage ImageStorageLocation { get; set; }
Property Value:

Gets or sets a value indication where the CaptchaImage is stored.

When the image is stored in the session the RadCaptcha HttpHandler definition (in the web.config file) must be changed from type="Telerik.Web.UI.WebResource" to type="Telerik.Web.UI.WebResourceSession" so that the image can be retrieved from the Session.

Gets or sets the invisible textbox strategy label text.

C#
public string InvisibleTextBoxLabel { get; set; }
Property Value:

The invisible textbox strategy label text.

Gets or sets a value indicating whether the user-entered content in the RadCaptcha control passes validation.

C#
public bool IsValid { get; set; }

Implements: IValidator.IsValid

Gets or sets the minimum number of seconds the form must be displayed before it is valid. If you're too fast, you must be a robot.

C#
public int MinTimeout { get; set; }
Property Value:

The minimum number of seconds the form must be displayed before it is valid.

Gets or sets the text displayed in the MissingPlugin download link.

C#
public string MissingPluginText { get; set; }

Gets or sets the name of the JavaScript function that will be called when the RadCaptcha is loaded on the page.

C#
[ClientControlEvent]
[ClientPropertyName("load")]
public string OnClientLoad { get; set; }

Gets or sets which strategies are/to be used for automatic robot discovery.

C#
public RadCaptcha.ProtectionStrategies ProtectionMode { get; set; }
Property Value:

The Modes used for Spam Protection.

Gets or sets the access key for generating new captcha image.

C#
public string RefreshImageAccessKey { get; set; }

Gets or sets the tab index of the RadCaptcha text box.

C#
public override short TabIndex { get; set; }
Property Value:

The tab index of the RadCaptcha text box.

Overrides: RadWebControl.TabIndex

Composite property containing decoration options of the inner TextBox control

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public WebControlDecorator TextBoxDecoration { get; }

Composite property containing decoration options of the inner Label control

C#
[PersistenceMode(PersistenceMode.InnerProperty)]
public WebControlDecorator TextBoxLabelDecoration { get; }

Gets the TextBox that is being validated by the RadCaptcha.

C#
[Browsable(false)]
public TextBox ValidatedTextBox { get; }
Property Value:

Returns a TextBox object that is being validated by the RadCaptcha.

Gets or sets the ID of the textbox to be validated, when only the RadCaptcha image is rendered on the page.

C#
public string ValidatedTextBoxID { get; set; }
Property Value:

String value indicating the ID of the textbox to be validated, when only the RadCaptcha image is rendered.

Gets the ITextControl that is being validated by the RadCaptcha.

C#
public ITextControl ValidatedTextControl { get; }

Gets or sets the validation group.

C#
public string ValidationGroup { get; set; }
Property Value:

The validation group.

Methods

Gets the CSS class set to the RadCaptcha after validation occurs. If RadCaptcha.IsValid=true, the "rcValid" is returned and "rcInvalid" when the captcha is not valid.

C#
protected virtual string GetValidationCssClass(bool isValid = true)
Parameters:isValidbool

Bool value indicating whether the user entered the correct value.

Returns:

string

Returns "rcValid" if the captcha is valid (RadCaptcha.IsValid=true), otherwise "rcInvalid".

Raises the CaptchaValidate event before the default validation executes.

C#
protected virtual void OnCaptchaValidate(CaptchaValidateEventArgs e)
Parameters:eCaptchaValidateEventArgs

A CaptchaValidateEventArgs that contains the event data.

Performs validation of the RadCaptcha control.

C#
public void Validate()

Implements: IValidator.Validate()

Events

Adds or removes an event handler method from the CaptchaValidate event. The event is fired before the RadCaptcha is validated.

C#
public event RadCaptchaEventHandler CaptchaValidate