Saturday, February 25, 2012

AspNetSessionExpiredException - Your results may vary?

I have a custom reporting application that displays Sql Server Reporting Services reports on an ASP.NET page using Microsoft's report viewer control. The SSRS reports are local reports (they have an rdlc extension).

When a report is left inactive for a lengthy period of time it generates anAspNetSessionExpiredException when the user attempts to move to a new page. The thing that is surprising is that the formatted exception display is contained within the report viewer. The report document map remains visible as does the report toolbar. In the right pane where the report normally appears I see a standard, raw, ASP.NET exception display.

I'm surprised that the report viewer is "catching" the exception and displaying it within the report viewer. Standard events in the page that hosts the report viewer (PreInit, Init, PageLoad) are never invoked.

I have graceful error handling defined in a base page class but it does me no good because the exception never reaches the page code-behind. Puzzling.

Do any of you ASP.NET developers know if it is possible to catch theAspNetSessionExpiredExceptionso that I can handle it in my application code rather than having SSRS display a very ugly, very raw exception message.

I've included the exception message below.

Thanks.

BlackCatBone

...

Server Error in '/templatedemo' Application.

------------------------

ASP.NET session has expired

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Microsoft.Reporting.WebForms.AspNetSessionExpiredException: ASP.NET session has expired

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[AspNetSessionExpiredException: ASP.NET session has expired]

Microsoft.Reporting.WebForms.ReportDataOperation..ctor() +683

Microsoft.Reporting.WebForms.HttpHandler.GetHandler() +553

Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +10

System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154

System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

------------------------

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

I am having exactly the same problem. If anyone knows the solution to this it would be fabulous to here from you.

|||

I had the same problem and I found the solution in this posthttp://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=170875&SiteID=1. See Brian Hartman's post regarding sessionState. I used his suggestion of using the out-of-process session state as StateServer mode and it fixed the issue for me. Good luck.

No comments:

Post a Comment