LocalReport.SetBasePermissionsForSandboxAppDomain Method (PermissionSet)


Sets the base permissions for the sandboxed application domain with the supplied permission set.

Namespace:   Microsoft.Reporting.WinForms
Assembly:  Microsoft.ReportViewer.WinForms (in Microsoft.ReportViewer.WinForms.dll)


public void SetBasePermissionsForSandboxAppDomain(
    PermissionSet permissions
void SetBasePermissionsForSandboxAppDomain(
    PermissionSet^ permissions
member SetBasePermissionsForSandboxAppDomain : 
        permissions:PermissionSet -> unit
Public Sub SetBasePermissionsForSandboxAppDomain (
    permissions As PermissionSet



The base permissions in the sandboxed application domain apply to custom code assemblies and the evaluation of report expressions. Note that this method replaces any existing base permission set with the supplied permission set. You should make sure that the supplied permission set includes the Execution permission. Otherwise, no custom code assemblies can be executed and no expressions can be evaluated.

If you change the permissions, make sure that the LocalReport object cannot be used to access any untrusted report definitions. In .NET Framework 3.5 (or in .NET Framework 4 with enabled), you must explicitly call the ExecuteReportInSandboxAppDomain method to switch to the sandboxed application domain mode.


Legacy Code Example

The following code adds file input and output permissions to the default base permission set.

PermissionSet permissions = new PermissionSet(PermissionState.None);
permissions.AddPermission(new FileIOPermission(PermissionState.Unrestricted));
permissions.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));

Dim permissions As New PermissionSet(PermissionState.None)
permissions.AddPermission(New FileIOPermission(PermissionState.Unrestricted))
permissions.AddPermission(New SecurityPermission(SecurityPermissionFlag.Execution))



See Also

LocalReport Class
Microsoft.Reporting.WinForms Namespace

Return to top