xtrareports-devexpress-dot-xtrareports-dot-web-dot-webdocumentviewer-11e3a137.md
Enables you to handle server-side errors in the Web Document Viewer.
Namespace : DevExpress.XtraReports.Web.WebDocumentViewer
Assembly : DevExpress.XtraReports.v25.2.Web.dll
NuGet Package : DevExpress.Web.Reporting.Common
public class WebDocumentViewerExceptionHandler :
ExceptionHandler,
IWebDocumentViewerExceptionHandler,
IExceptionHandler
Public Class WebDocumentViewerExceptionHandler
Inherits ExceptionHandler
Implements IWebDocumentViewerExceptionHandler,
IExceptionHandler
The WebDocumentViewerExceptionHandler class provides the following methods:
The code snippet below demonstrates how to create a descendant from this class and override the GetUnknownExceptionMessage method to return an actual exception message.
using System;
using DevExpress.XtraReports.Web.WebDocumentViewer;
public class CustomWebDocumentViewerExceptionHandler : WebDocumentViewerExceptionHandler {
public override string GetUnknownExceptionMessage(Exception ex) {
return ex.Message;
}
}
Imports System
Imports DevExpress.XtraReports.Web.WebDocumentViewer
Public Class CustomWebDocumentViewerExceptionHandler
Inherits WebDocumentViewerExceptionHandler
Public Overrides Function GetUnknownExceptionMessage(ByVal ex As Exception) As String
Return ex.Message
End Function
End Class
To register the implemented exception handler, use the static DefaultWebDocumentViewerContainer.Register method at the application’s startup as shown below:
void Application_Start(object sender, EventArgs e) {
// ...
DevExpress.XtraReports.Web.WebDocumentViewer.DefaultWebDocumentViewerContainer.
Register<IWebDocumentViewerExceptionHandler, CustomWebDocumentViewerExceptionHandler>();
}
Private Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' ...
DevExpress.XtraReports.Web.WebDocumentViewer.DefaultWebDocumentViewerContainer.
Register(Of IWebDocumentViewerExceptionHandler, CustomWebDocumentViewerExceptionHandler)()
End Sub
See the following topics for more information:
IWebDocumentViewerExceptionHandler
Object ExceptionHandler WebDocumentViewerExceptionHandler
See Also