Skip to main content
All docs
V25.2
  • ASPxSpreadsheetUriValidationContext.Editor Property

    Returns the ASPxSpreadsheet component initiated URL validation.

    Namespace: DevExpress.Web.ASPxSpreadsheet

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

    NuGet Package: DevExpress.Web.Office

    Declaration

    public ASPxSpreadsheet Editor { get; }

    Property Value

    Type Description
    ASPxSpreadsheet

    An ASPxSpreadsheet instance.

    Remarks

    Use the Editor property to access the ASPxSpreadhsheet component instance in URL validation handlers. Note that Editor property value can be null in the following cases:

    • You import documents that contain external images.
    • You insert images via the UI, clipboard, or API.

    Use the DocumentInfo property instead to identify the event sender.

    The following code snippet enables requests to internal network resources in the specified Spreadsheet document:

    using System;
    using DevExpress.Security.Resources;
    using DevExpress.Web.ASPxSpreadsheet;
    
    protected void Application_Start(object sender, EventArgs e) {
        AccessSettings.UriValidated += OnUriValidated;
    }
    
    void OnUriValidated(object sender, UriValidatedEventArgs e) {
        // Checks if a validation request comes from ASPxSpreadsheet
        if(e.ValidationContext is ASPxSpreadsheetUriValidationContext spreadsheetContext) {
            if(spreadsheetContext.DocumentInfo.DocumentId == "MyDocumentId" && e.Uri != null) {
                // Specifies allowed hosts
                if(e.Uri.IdnHost.Equals("localhost", StringComparison.OrdinalIgnoreCase)) {
                    e.Valid = true;
                }
            }
        }
    }
    
    See Also