共用方式為


LocalReport.SetBasePermissionsForSandboxAppDomain 方法

使用提供的權限集合,設定沙箱應用程式定義域的基本權限。

命名空間:  Microsoft.Reporting.WinForms
組件:  Microsoft.ReportViewer.WinForms (在 Microsoft.ReportViewer.WinForms.dll 中)

語法

'宣告
Public Sub SetBasePermissionsForSandboxAppDomain ( _
    permissions As PermissionSet _
)
public void SetBasePermissionsForSandboxAppDomain(
    PermissionSet permissions
)
public:
void SetBasePermissionsForSandboxAppDomain(
    PermissionSet^ permissions
)
member SetBasePermissionsForSandboxAppDomain : 
        permissions:PermissionSet -> unit 
public function SetBasePermissionsForSandboxAppDomain(
    permissions : PermissionSet
)

參數

  • permissions
    類型:PermissionSet
    要設定的 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 LegacySecurityPolicy enabled), you must explicitly call the ExecuteReportInSandboxAppDomain method to switch to the sandboxed application domain mode.

範例

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));

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

ReportViewer1.LocalReport.SetBasePermissionForSandboxAppDomain(permissions)

請參閱

參考

LocalReport 類別

Microsoft.Reporting.WinForms 命名空間