Catching the rsExecutionNotFound exception RRS feed

  • Question

  • We get rsExecutionNotFound errors regularly throughout the day from our web application's users. I know this is because the SSRS session has timed out. I think it's because a lot of our users leave particular reports open for long periods of time (e.g. all day, or even overnight for the next day). These reports change regularly throughout the day. A lot of these users have laptops that are connected wirelessly to our network and I suspect that they miss one of the ReportViewer's ping-backs to refresh the SSRS session. This is probably due to them moving about and going in and out of wireless reception, or closing the laptop lid which often switches off the netwok card.

    I want to prevent them seeing the yellow error page, and display a more friendly message instead, encouraging them to run the report again from scratch. So I would like to catch the exception thrown when you see a rsExecutionNotFound error, but have been unable to do it. I thought the ReportViewer.ReportError event would help, but it doesn't seem to fire. I've even tried putting a try-catch round the whole page load, but I don't think the ReportViewer control is returning the exception to the page. Anybody got any ideas?

    Page code is:

    <rsweb:ReportViewer ID="reportHolder" OnReportError="reportHolder_ReportError" runat="server" ProcessingMode="Remote" Width="100%" ShowCredentialPrompts="false" ShowParameterPrompts="false" SizeToReportContent="True" ZoomMode="PageWidth" HyperlinkTarget="_blank"> <ServerReport DisplayName="blah" ReportServerUrl="http://abc/ReportServer" /> </rsweb:ReportViewer>

    The ReportError event handler looks like this:

    protected void reportHolder_ReportError(object sender, ReportErrorEventArgs e)
    if (typeof(ReportServerException) == e.Exception.GetType() && ((ReportServerException)e.Exception).ErrorCode == "rsExecutionNotFound")

    Where ReportSessionExpiry() displays my friendly message. I cannot get the event to fire, though, when I get the rsExecutionNotFound error. To replicate the error, run a report, disconnect from the network, wait till the timeout has passed, re-connect, click the report refresh button.

    I'm running SSRS 2005, .NET 2.0, WinXP, IE6. I don't have any choice with these versions.

    Friday, July 3, 2009 1:00 PM

All replies

  • When the report viewer is running in asynchronous mode (the default), the report is processed by the viewer's HTTP handler, which does not have the ability to call into code in the ASPX page.  You can set AsyncRendering to false to cause the viewer to process the report in the ASPX page, in which case your event handler will be called.  This restriction will be removed in the next release of the report viewer.

    You might also be able to hook up to the HttpApplication.Error event ( to handle this error, but I have not tried this personally, so I'm not 100% certain it will work.

    Thursday, July 9, 2009 2:10 AM
  • Thanks for the reply, Brian. I don't think I want to set AsyncRendering to false, having read some of the other forum replies you have made. Some of the reports that are loaded into this viewer are long with several pages.

    How would I hook up the HttpApplication.Error event if I wanted to try that? Do I just add a handler to the page.Error handlers? If so, how do I get the particular exception I'm after (ReportServerException) out of the event args?
    Thursday, July 9, 2009 10:47 AM
  • HttpApplication is an application level object, not a page level object.  You can hook up to the event in your Global.asax file.
    Sunday, July 12, 2009 1:09 AM