Back to Devexpress

ASPxWebDocumentViewer.StaticInitialize() Method

xtrareports-devexpress-dot-xtrareports-dot-web-dot-aspxwebdocumentviewer.md

latest8.0 KB
Original Source

ASPxWebDocumentViewer.StaticInitialize() Method

Explicitly starts the Web Document Viewer initialization.

Namespace : DevExpress.XtraReports.Web

Assembly : DevExpress.XtraReports.v25.2.Web.WebForms.dll

NuGet Package : DevExpress.Web.Reporting

Declaration

csharp
public static void StaticInitialize()
vb
Public Shared Sub StaticInitialize

Remarks

The ASPxWebDocumentViewer is automatically initialized when rendering on your application’s Web page, but in specific cases, you need to trigger its initialization explicitly (for instance, when an AppPool is recycled).

The StaticInitialize method does the following:

  • Calls the static ASPxWebDocumentViewer constructor;
  • Registers HttpHandlers required for the Web Document Viewer;
  • Initializes all services for processing requests to the corresponding handler.

Use the StaticInitialize method at the application startup in the Global.asax file.

Note

To make the Document Viewer’s handlers work correctly, you should call this method after specifying the session state and registering additional services.

csharp
protected void Application_Start(Object sender, EventArgs e) {
    // ...  
   DevExpress.XtraReports.Web.WebDocumentViewer.Native.WebDocumentViewerBootstrapper.SessionState = 
        System.Web.SessionState.SessionStateBehavior.Required;
    // ...  
    DevExpress.XtraReports.Web.ASPxWebDocumentViewer.StaticInitialize();
}
vb
Protected Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
    ' ...  
    DevExpress.XtraReports.Web.WebDocumentViewer.Native.WebDocumentViewerBootstrapper.SessionState = 
        System.Web.SessionState.SessionStateBehavior.Required
    ' ...  
    DevExpress.XtraReports.Web.ASPxWebDocumentViewer.StaticInitialize
End Sub

The following code snippets (auto-collected from DevExpress Examples) contain references to the StaticInitialize() 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.

reporting-web-mvc-email-report/CS/CustomDocumentOperationService/Global.asax.cs#L23

csharp
MVCxWebDocumentViewer.StaticInitialize();
AreaRegistration.RegisterAllAreas();

reporting-web-cacheddocumentsource-custom-data/CS/CustomCachedDocumentSourceSerialization/Global.asax.cs#L12

csharp
DevExpress.XtraReports.Web.WebDocumentViewer.DefaultWebDocumentViewerContainer.UseFileDocumentStorage(Server.MapPath("~/App_Data/PreviewedDocuments/"));
ASPxWebDocumentViewer.StaticInitialize();

reporting-mvc-generate-report-dynamically-for-specified-query/CS/ReportForQueryExample/Global.asax.cs#L21

csharp
System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12;
            MVCxWebDocumentViewer.StaticInitialize();

reporting-mvc-display-information-in-xrpageinfo/CS/WebDocumentViewer_UserName/Global.asax.cs#L26

csharp
System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12;
MVCxWebDocumentViewer.StaticInitialize();

reporting-web-forms-view-report/CS/Global.asax.cs#L16

csharp
DefaultWebDocumentViewerContainer.Register<IReportProvider, CustomReportProvider>();
    DevExpress.XtraReports.Web.ASPxWebDocumentViewer.StaticInitialize();
}

reporting-web-mvc-email-report/VB/CustomDocumentOperationService/Global.asax.vb#L26

vb
MVCxWebDocumentViewer.StaticInitialize()
AreaRegistration.RegisterAllAreas()

reporting-web-cacheddocumentsource-custom-data/VB/CustomCachedDocumentSourceSerialization/Global.asax.vb#L14

vb
DevExpress.XtraReports.Web.WebDocumentViewer.DefaultWebDocumentViewerContainer.UseFileDocumentStorage(Server.MapPath("~/App_Data/PreviewedDocuments/"))
ASPxWebDocumentViewer.StaticInitialize()

reporting-mvc-generate-report-dynamically-for-specified-query/VB/ReportForQueryExample/Global.asax.vb#L13

vb
System.Net.ServicePointManager.SecurityProtocol = System.Net.ServicePointManager.SecurityProtocol Or System.Net.SecurityProtocolType.Tls12
MVCxWebDocumentViewer.StaticInitialize()
DevExpress.XtraReports.Web.ClientControls.LoggerService.Initialize(Sub(ex, message)

reporting-mvc-display-information-in-xrpageinfo/VB/WebDocumentViewer_UserName_VB/Global.asax.vb#L19

vb
System.Net.ServicePointManager.SecurityProtocol = System.Net.ServicePointManager.SecurityProtocol Or System.Net.SecurityProtocolType.Tls12
MVCxWebDocumentViewer.StaticInitialize()
DevExpress.XtraReports.Web.ClientControls.LoggerService.Initialize(Sub(ex, message)

reporting-web-forms-view-report/VB/Global.asax.vb#L17

vb
DefaultWebDocumentViewerContainer.Register(Of IReportProvider, CustomReportProvider)()
    DevExpress.XtraReports.Web.ASPxWebDocumentViewer.StaticInitialize()
End Sub

See Also

ASPxWebDocumentViewer Class

ASPxWebDocumentViewer Members

DevExpress.XtraReports.Web Namespace