WebDocumentViewerExceptionHandler Class
Enables you to handle server-side errors in the Web Document Viewer.
Namespace: DevExpress.XtraReports.Web.WebDocumentViewer
Assembly: DevExpress.XtraReports.v24.2.Web.dll
NuGet Package: DevExpress.Web.Reporting.Common
#Declaration
public class WebDocumentViewerExceptionHandler :
ExceptionHandler,
IWebDocumentViewerExceptionHandler,
IExceptionHandler
#Remarks
The WebDocumentViewerExceptionHandler class provides the following methods:
- GetUnknownExceptionMessage to handle exceptions of non-standard types, for which the Document Viewer shows the standard ‘Internal Server Error’ message;
- GetFaultExceptionMessage to handle FaultException;
- DocumentCreationException to handle errors related to the document creation process;
- GetExceptionMessage to handle all possible errors independently from their types.
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;
}
}
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>();
}
See the following topics for more information:
- Handle Server-Side Errors in the Document Viewer (ASP.NET Web Forms)
- Handle Server-Side Errors in the Document Viewer (ASP.NET MVC)
- Handle Server-Side Errors in the Document Viewer (ASP.NET Core)