corelibraries-devexpress-dot-security-dot-resources-dot-accesssettings-dot-setrules-x28-devexpress-dot-security-dot-resources-dot-iaccessrule-x29.md
Sets resource access rules. Raises an exception if this method is called for the second time while the application is running.
Namespace : DevExpress.Security.Resources
Assembly : DevExpress.Data.v25.2.dll
NuGet Package : DevExpress.Data
public void SetRules(
params IAccessRule[] rules
)
Public Sub SetRules(
ParamArray rules As IAccessRule()
)
| Name | Type | Description |
|---|---|---|
| rules | IAccessRule[] |
An array of access rules.
|
Before you set access rules, specify the resources for which these rules should be checked. To do this, use one of the following static properties:
The SetRules(IAccessRule[]) method can be called only once while the application is running. This allows rules to not be overridden. An attempt to call this method for the second time leads to an exception. So, call this method when your application starts to specify rules before a control (for example, Web End-User ReportDesigner) sets its rules.
The following code snippets (auto-collected from DevExpress Examples) contain references to the SetRules(IAccessRule[]) 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());
}
asp-net-web-forms-page-control-create-a-wizard/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")),
use-recaptcha-with-devexpress/CS/ReCaptcha/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());
}
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