ASPxHtmlEditorUriValidationContext.Editor Property
Returns the ASPxHtmlEditor component initiated URL validation.
Namespace: DevExpress.Web.ASPxHtmlEditor
Assembly: DevExpress.Web.ASPxHtmlEditor.v25.2.dll
NuGet Package: DevExpress.Web
Declaration
Property Value
| Type | Description |
|---|---|
| ASPxHtmlEditor | An |
Remarks
Use the Editor property to access the ASPxHtmlEditor 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 the via UI, clipboard, or API.
The following code snippet enables requests to internal network resources in the specified DevExpress.Web.ASPxHtmlEditor component:
using System;
using DevExpress.Security.Resources;
using DevExpress.Web.ASPxHtmlEditor;
protected void Application_Start(object sender, EventArgs e) {
AccessSettings.UriValidated += OnUriValidated;
}
void OnUriValidated(object sender, UriValidatedEventArgs e) {
// Checks if a validation request comes from ASPxHtmlEditor
if(e.ValidationContext is ASPxHtmlEditorUriValidationContext htmlEditorContext) {
var editor = htmlEditorContext.Editor;
if(editor != null && editor.ID == "MyHtmlEditor" && e.Uri != null) {
// Specifies allowed hosts
if(e.Uri.IdnHost.Equals("localhost", StringComparison.OrdinalIgnoreCase)) {
e.Valid = true;
}
}
}
}
See Also