LocalReport.ExecuteReportInCurrentAppDomain Method
This page is specific to:.NET Framework Version:2.03.54.0
LocalReport.ExecuteReportInCurrentAppDomain Method

Causes processing extensions and expressions in the report to be executed in the current AppDomain.

Namespace: Microsoft.Reporting.WinForms
Assembly: Microsoft.ReportViewer.WinForms (in microsoft.reportviewer.winforms.dll)
Syntax

'Usage

Dim instance As LocalReport
Dim reportEvidence As Evidence

instance.ExecuteReportInCurrentAppDomain(reportEvidence)

'Declaration

Public Sub ExecuteReportInCurrentAppDomain ( _
    reportEvidence As Evidence _
)
public void ExecuteReportInCurrentAppDomain (
    Evidence reportEvidence
)

Parameters

reportEvidence

An Evidence object that contains security information about the report.

Remarks

Expressions in the report will be run in the current AppDomain with only the Execution security permission flag. By default, custom assemblies are not allowed in this mode. This is the default mode and is the mode to use for trusted reports.

This mode may also be used to run untrusted reports that do use trusted processing extensions.

To allow trusted processing extensions, the application must call AddTrustedCodeModuleInCurrentAppDomain.

Example

In this example, a custom assembly containing a simple utility function that reads some data from a text file is used as an expression in a report.

using System.IO;
using System.Reflection;

public class Util
{
    public static string GetData()
    {
        StreamReader sr = new StreamReader("data.txt");
        string data = sr.ReadToEnd();
        sr.Close();
        return data;
    }
}

The following code is used to allow the report with the custom assembly to run in the current AppDomain.

reportViewer.LocalReport.ReportPath = "Report1.rdlc";
reportViewer.LocalReport.ExecuteReportInCurrentAppDomain(
      Assembly.GetExecutingAssembly().Evidence);
reportViewer.LocalReport.AddTrustedCodeModuleInCurrentAppDomain("Contoso.Utilities, 
      Version=1.0.271.0, Culture=neutral, PublicKeyToken=89012dab8080cc90");
See Also

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View