corelibraries-devexpress-dot-security-dot-resources-dot-directoryaccessrule-dot-allow-x28-system-dot-string-x29.md
Creates the DirectoryAccessRule that allows resource loading only from the file directories passed as the parameter.
Namespace : DevExpress.Security.Resources
Assembly : DevExpress.Data.v25.2.dll
NuGet Package : DevExpress.Data
public static DirectoryAccessRule Allow(
params string[] directories
)
Public Shared Function Allow(
ParamArray directories As String()
) As DirectoryAccessRule
| Name | Type | Description |
|---|---|---|
| directories | String[] |
An array of file directories that this rule allows. Other directories are considered as denied in this application.
|
| Type | Description |
|---|---|
| DirectoryAccessRule |
An instance of the DirectoryAccessRule class.
|
You can pass nothing as the method’s parameter to create a rule that allows access to all file directories:
// Image load from file directories is allowed
DevExpress.Security.Resources.AccessSettings.StaticResources.SetRules(DirectoryAccessRule.Allow());
' Image load from file directories is allowed
DevExpress.Security.Resources.AccessSettings.StaticResources.SetRules(DirectoryAccessRule.Allow())
Pass the file directories that should be accessible in the application to allow resource loading only from them:
// Image load is allowed only from the specified file directories.
DevExpress.Security.Resources.AccessSettings.StaticResources.SetRules(DirectoryAccessRule.Allow("http://mysite.dev"));
' Image load is allowed only from the specified file directories.
DevExpress.Security.Resources.AccessSettings.StaticResources.SetRules(DirectoryAccessRule.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());
}
mvc-dashboard-download-dashboard-xml-definition/CS/Global.asax.cs#L42
ModelBinders.Binders.DefaultBinder = new DevExpressEditorsBinder();
AccessSettings.StaticResources.TrySetRules(DirectoryAccessRule.Allow());
angular-reporting-handle-parameters-initialized-event/CS/ReportingWebApp/Startup.cs#L46
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) {
var contentDirectoryAllowRule = DirectoryAccessRule.Allow(new DirectoryInfo(Path.Combine(env.ContentRootPath, "..", "Content")).FullName);
AccessSettings.ReportingSpecificResources.TrySetRules(contentDirectoryAllowRule, UrlAccessRule.Allow());
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