HyperLinkPropertiesNavigateUrlValidationContext Class
Identifies the context of an URL validation request in grid-based components.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v25.2.dll
NuGet Package: DevExpress.Web
Declaration
Remarks
Grid-based components (ASPxGridView, ASPxCardView, ASPxVerticalGrid, ASPxTreeList, and their MVC and Bootstrap counterparts) support hyperlink columns that display their contents as hyperlinks. When the RemovePotentiallyDangerousNavigateUrl property is enabled, components validate URL schemes to prevent potential threats.
To override URL validation behavior in hyperlink columns, handle the UriValidated event. In the event handler, a HyperLinkPropertiesNavigateUrlValidationContext instance identifies the component (UriOwner) that initiated URL validation.
The following code snippet enables requests to internal network resources in the specified ASPxGridView control:
using System;
using DevExpress.Security.Resources;
protected void Application_Start(object sender, EventArgs e) {
AccessSettings.UriValidated += OnUriValidated;
}
void OnUriValidated(object sender, UriValidatedEventArgs e) {
if(e.ValidationContext is HyperLinkPropertiesNavigateUrlValidationContext hyperLinkValidationContext) {
if(hyperLinkValidationContext.UriOwner is ASPxGridView gridView) {
if(e.Uri != null && e.Uri.IdnHost.Equals("localhost", StringComparison.OrdinalIgnoreCase)) {
e.Valid = true;
}
}
}
}
Refer to the following help topic for additional information: Safe URL Validation.