Back to Devexpress

UserDesignerOptions.ReportLoadingRestrictionLevel Property

xtrareports-devexpress-dot-xtrareports-dot-configuration-dot-userdesigneroptions-da234204.md

latest5.6 KB
Original Source

UserDesignerOptions.ReportLoadingRestrictionLevel Property

Specifies whether end-users are allowed to load untrusted reports with potentially dangerous content in a desktop reporting application.

Namespace : DevExpress.XtraReports.Configuration

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public RestrictionLevel ReportLoadingRestrictionLevel { get; set; }
vb
Public Property ReportLoadingRestrictionLevel As RestrictionLevel

Property Value

TypeDescription
RestrictionLevel

A RestrictionLevel enumeration value.

|

Available values:

NameDescription
Enable

Permit loading untrusted reports by end-users via application GUI.

| | Disable |

Forbid loading untrusted reports by end-users via application GUI.

| | Prompt |

Ask for an end-user’s permission on every attempt to load an untrusted report.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to ReportLoadingRestrictionLevel
ReportingSettings

.UserDesignerOptions .ReportLoadingRestrictionLevel

| | Settings |

.UserDesignerOptions .ReportLoadingRestrictionLevel

|

Remarks

End-User Report Designer (WinForms and WPF) displays the following warning when a user attempts to load a potentially unsafe report:

A report is considered unsafe if it or any of its subreports contain any of the following:

The following code prevents users from loading unsafe reports:

csharp
static class Program {
    static void Main() {
        DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.ReportLoadingRestrictionLevel =
    DevExpress.XtraReports.UI.RestrictionLevel.Disable;
    }
}
vb
Partial Friend Class MyApplication
    Public Sub New()
        MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
        DevExpress.XtraReports.Configuration.Settings.Default.UserDesignerOptions.ReportLoadingRestrictionLevel = _
            DevExpress.XtraReports.UI.RestrictionLevel.Disable
    End Sub
End Class

The code above displays the error message when the user attempts to load a potentially unsafe report.

In a restricted environment where all reports are guaranteed to be safe, you can disable this warning and allow users to load any report by setting the UserDesignerOptions.ReportLoadingRestrictionLevel property to RestrictionLevel.Enable.

The following code lets you determine whether a report is considered unsafe, and displays detected security warnings in the Output window:

csharp
var traceSource = DevExpress.XtraPrinting.Tracer.GetSource("DXperience.Reporting", 
    System.Diagnostics.SourceLevels.Error | System.Diagnostics.SourceLevels.Warning);
var listener = new System.Diagnostics.DefaultTraceListener();
traceSource.Listeners.Add(listener);
try {
    new XtraReport1().ShowRibbonDesignerDialog();
} finally {
    traceSource.Listeners.Remove(listener);
}
vb
Dim traceSource = DevExpress.XtraPrinting.Tracer.GetSource("DXperience.Reporting", _ 
    System.Diagnostics.SourceLevels.[Error] Or System.Diagnostics.SourceLevels.Warning)
Dim listener = New System.Diagnostics.DefaultTraceListener()
traceSource.Listeners.Add(listener)
Try
    New XtraReport1().ShowRibbonDesignerDialog()
Finally
    traceSource.Listeners.Remove(listener)
End Try

See Also

UserDesignerOptions Class

UserDesignerOptions Members

DevExpress.XtraReports.Configuration Namespace