corelibraries-devexpress-dot-security-dot-resources-dot-urlaccessrule-dot-allow-x28-system-dot-string-x29.md
Creates the UrlAccessRule rule that allows resource loading only from the URLs passed as the parameter.
Namespace : DevExpress.Security.Resources
Assembly : DevExpress.Data.v25.2.dll
NuGet Package : DevExpress.Data
public static UrlAccessRule Allow(
params string[] urls
)
Public Shared Function Allow(
ParamArray urls As String()
) As UrlAccessRule
| Name | Type | Description |
|---|---|---|
| urls | String[] |
An array of URLs that this rule allows. Other URLs are considered as denied in this application.
|
| Type | Description |
|---|---|
| UrlAccessRule |
An instance of the UrlAccessRule class.
|
You can pass nothing as the method’s parameter to create a rule that allows access to all URLs:
// Image load from URLs is allowed
DevExpress.Security.Resources.AccessSettings.StaticResources.SetRules(UrlAccessRule.Allow());
' Image load from URLs is allowed
DevExpress.Security.Resources.AccessSettings.StaticResources.SetRules(UrlAccessRule.Allow())
Pass the URLs that should be accessible in the application to allow resource loading only from them:
// Image load is allowed only from the specified URL.
DevExpress.Security.Resources.AccessSettings.StaticResources.SetRules(UrlAccessRule.Allow("http://mysite.dev"));
' Image load is allowed only from the specified URL.
DevExpress.Security.Resources.AccessSettings.StaticResources.SetRules(UrlAccessRule.Allow("http://mysite.dev"))
The following code snippets (auto-collected from DevExpress Examples) contain references to the Allow(String[]) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
web-forms-dashboard-update-parameter-master-filter-changed/CS/DXApplication33/Global.asax.cs#L8
DevExpress.Web.ASPxWebControl.CallbackError += new EventHandler(Application_Error);
DevExpress.Security.Resources.AccessSettings.DataResources.SetRules(DevExpress.Security.Resources.DirectoryAccessRule.Allow(Server.MapPath("~/Content")), DevExpress.Security.Resources.UrlAccessRule.Allow());
}
asp-net-web-forms-splitter-resize-pane-to-fit-content/CS/Solution/Global.asax.cs#L7
void Application_Start(object sender, EventArgs e) {
AccessSettings.DataResources.SetRules(DirectoryAccessRule.Allow(Server.MapPath("~/Content")), UrlAccessRule.Allow());
}
asp-net-web-forms-gridlookup-dropdown-with-grouped-items/CS/DXWebApplication1/Global.asax.cs#L7
DevExpress.Web.ASPxWebControl.CallbackError += new EventHandler(Application_Error);
DevExpress.Security.Resources.AccessSettings.DataResources.SetRules(DevExpress.Security.Resources.DirectoryAccessRule.Allow(Server.MapPath("~/Content")), DevExpress.Security.Resources.UrlAccessRule.Allow());
}
angular-reporting-handle-parameters-initialized-event/CS/ReportingWebApp/Startup.cs#L47
var contentDirectoryAllowRule = DirectoryAccessRule.Allow(new DirectoryInfo(Path.Combine(env.ContentRootPath, "..", "Content")).FullName);
AccessSettings.ReportingSpecificResources.TrySetRules(contentDirectoryAllowRule, UrlAccessRule.Allow());
if (env.IsDevelopment()) {
angular-reporting-use-custom-ui-elements-to-specify-parameters/CS/ReportingWebApp/Startup.cs#L46
var contentDirectoryAllowRule = DirectoryAccessRule.Allow(new DirectoryInfo(Path.Combine(env.ContentRootPath, "..", "Content")).FullName);
AccessSettings.ReportingSpecificResources.TrySetRules(contentDirectoryAllowRule, UrlAccessRule.Allow());
if (env.IsDevelopment()) {
web-forms-dashboard-update-parameter-master-filter-changed/VB/DXApplication33/Global.asax.vb#L11
AddHandler DevExpress.Web.ASPxWebControl.CallbackError, New EventHandler(AddressOf Application_Error)
DevExpress.Security.Resources.AccessSettings.DataResources.SetRules(DevExpress.Security.Resources.DirectoryAccessRule.Allow(Server.MapPath("~/Content")), DevExpress.Security.Resources.UrlAccessRule.Allow())
End Sub
asp-net-web-forms-splitter-resize-pane-to-fit-content/VB/Solution/Global.asax.vb#L10
Private Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Call AccessSettings.DataResources.SetRules(DirectoryAccessRule.Allow(Server.MapPath("~/Content")), UrlAccessRule.Allow())
End Sub
asp-net-web-forms-gridlookup-dropdown-with-grouped-items/VB/DXWebApplication1/Global.asax.vb#L10
AddHandler DevExpress.Web.ASPxWebControl.CallbackError, New EventHandler(AddressOf Application_Error)
DevExpress.Security.Resources.AccessSettings.DataResources.SetRules(DevExpress.Security.Resources.DirectoryAccessRule.Allow(Server.MapPath("~/Content")), DevExpress.Security.Resources.UrlAccessRule.Allow())
End Sub
use-recaptcha-with-devexpress/VB/ReCaptcha/Global.asax.vb#L10
AddHandler DevExpress.Web.ASPxWebControl.CallbackError, New EventHandler(AddressOf Application_Error)
DevExpress.Security.Resources.AccessSettings.DataResources.SetRules(DevExpress.Security.Resources.DirectoryAccessRule.Allow(Server.MapPath("~/Content")), DevExpress.Security.Resources.UrlAccessRule.Allow())
End Sub
web-forms-customize-merge-field-names/VB/handle-customizemergefields-event/Global.asax.vb#L10
AddHandler DevExpress.Web.ASPxWebControl.CallbackError, New EventHandler(AddressOf Application_Error)
DevExpress.Security.Resources.AccessSettings.DataResources.SetRules(DevExpress.Security.Resources.DirectoryAccessRule.Allow(Server.MapPath("~/Content")), DevExpress.Security.Resources.UrlAccessRule.Allow())
End Sub
See Also