WebDocumentViewerExceptionHandler.GetExceptionMessage(Exception) Method

Enables you to handle all server-side errors independent of their types.

Namespace: DevExpress.XtraReports.Web.WebDocumentViewer

Assembly: DevExpress.XtraReports.v21.1.Web.dll


public override string GetExceptionMessage(
    Exception ex


Name Type Description
ex Exception

An exception that occurs on the server side.


Type Description

A string to show in a browser when an error occurs.


The GetExceptionMessage method is called when any server-side error occurs.

The code snippet below demonstrates how to create a descendant from the WebDocumentViewerExceptionHandler class and override the GetExceptionMessage method to return an actual exception message.

using System;
using DevExpress.XtraReports.Web.WebDocumentViewer;

public class CustomWebDocumentViewerExceptionHandler : WebDocumentViewerExceptionHandler {
    public override string GetExceptionMessage(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) {
    // ...
      Register<IWebDocumentViewerExceptionHandler, CustomWebDocumentViewerExceptionHandler>();

See the following topics for more information:

See Also