Skip to main content
All docs
V25.2
  • ASPxRichEditUrlValidationContext Class

    Identifies the context of a hyperlink URL validation request in the ASPxRichEdit control.

    Namespace: DevExpress.Web.ASPxRichEdit

    Assembly: DevExpress.Web.ASPxRichEdit.v25.2.dll

    NuGet Package: DevExpress.Web.Office

    Declaration

    public sealed class ASPxRichEditUrlValidationContext :
        UriValidationContext

    Remarks

    The Rich Text Editor component validates hyperlink URL schemes to prevent malicious code execution.

    To override URL validation behavior, handle the UriValidated event. Event arguments include an instance of ASPxRichEditUrlValidationContext that identifies the ASPxRichEdit control that initiated the URL validation.

    The following code snippet allows FTP links in a specific DevExpress.Web.ASPxRichEdit control:

    using System;
    using DevExpress.Security.Resources;
    using DevExpress.Web.ASPxRichEdit;
    
    protected void Application_Start(object sender, EventArgs e) {
        AccessSettings.UriValidated += OnUriValidated;
    }
    
    void OnUriValidated(object sender, UriValidatedEventArgs e) {
        // Checks if validation request comes from ASPxRichEdit
        if (e.ValidationContext is ASPxRichEditUrlValidationContext richEditContext) {
            var editor = richEditContext.Editor;
            // Allows custom URI scheme for specific editor instances
            if (editor.ID == "MyRichEdit" && e.Uri != null) {
                if (e.Uri.Scheme.Equals("ftp", StringComparison.OrdinalIgnoreCase)) {
                    // Overrides validation to allow FTP links
                    e.Valid = true;
                }
            }
        }
    }
    

    Inheritance

    Object
    DevExpress.Security.UriValidationContext
    ASPxRichEditUrlValidationContext
    See Also