How to handle the "document is expired" error

If the document is expired, then ExecutionInfo is taken from cache, and the document is rendered once again on server. The message is not shown to the user in this case.

If ExecutionInfo is out of cache, then the document rendering is failed. The user gets the message in this case.

In order to handle the error message and, for example, to invoke the report rendering once again, you should subscribe to the Handler.

reportViewer.HandlingError += 
new EventHandler<ServerExceptionEventArgs>(reportViewer_HandlingError);
 
void reportViewer_HandlingError(object sender, ServerExceptionEventArgs e)
        {
            e.Handled = true;
            reportViewer.SetEmptyViewModel();
            reportViewer.RenderDocument();
        }

Add Feedback