Microsoft ReportViewer: Session Expired Errors
Asked Answered
C

7

22

The project is ASP.NET 2.0, I have never been able to reproduce this myself, but I get emails informing me it happens to clients many times a week, often a few times in a row.

Here is the full error:

Exception Details:

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

Stack Trace:

[AspNetSessionExpiredException: ASP.NET session has expired] at Microsoft.Reporting.WebForms.ReportDataOperation..ctor() at Microsoft.Reporting.WebForms.HttpHandler.GetHandler() at Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) Session Objects:75de8e1d65ff40d1ba666d940af5b118: Microsoft.Reporting.WebForms.ReportHierarchy 5210064be1fa4d6abf5dd5e56b262974: Microsoft.Reporting.WebForms.ReportHierarchy

Credit answered 7/10, 2008 at 14:4 Comment(0)
L
15

We had the same problem. So far, we only found it when the session expired but they used the back button in a browser that does aggressive caching, which is fine. But the ReportViewer tried to to a refresh even though the main page did not. So, we just added some hacky Global.asax error handling:

protected void Application_Error(object sender, EventArgs e)
{
    Exception exc = Server.GetLastError().GetBaseException();
    if (exc is Microsoft.Reporting.WebForms.AspNetSessionExpiredException)
    {
        Server.ClearError();
        Response.Redirect(FormsAuthentication.LoginUrl + "?ReturnUrl=" + HttpUtility.UrlEncode(Request.Url.PathAndQuery), true);
    }
}
Lowborn answered 7/10, 2008 at 14:48 Comment(2)
I tried this code in asp.net mvc 2 application. but this method wasn't called.Priester
@loviji: How are you using a ReportViewer in MVC? It is a WebForms control... Regardless, the Application_Error in Global.asax should work for all ASP.Net sites. Look up how to correctly use and setup the special Application_Error method in ASP.NET — there is a lot of help on the web on how to do that.Lowborn
C
3

Session Timeout

This can be due to your session timeout being too low. Check out the "sessionState" section of your Web.Config, e.g. :-

<system.web><sessionState mode="InProc" timeout="60" /></system.web>

Which would set a session timeout of 60 minutes.

Application Pool Recycle

Another possible cause, and one which we ran into, is that your application pool is being recycled for some reason.

In out case it was because we were hitting a "Maximum virtual memory" setting, I just upped that and everything has been fine since.

Have a look in your System Event Log for 1010, 1011, 1074, 1077, 1078, 1079, 1080 and 1117 events from W3SVC and see if your app pool is being recycled and if so, it should state why.

Confucius answered 27/10, 2008 at 15:10 Comment(0)
M
2

Here was my fix.

Running IIS on a web farm, and each farm has a web garden count=3 each,

I simply made a seperate application pool just for sql reports and set that web gardern count=1 just for this reporting pool.

then, made a virtual directory in IIS and a seperate project for reporting - using that reporting pool

problem solved.

Moslem answered 21/9, 2010 at 17:14 Comment(0)
T
1

I had this problem when developing on my own PC and could not find an answer anywhere on the net. It turned out that one of my teammates added this to the web.config:

<httpCookies httpOnlyCookies="false" requireSSL="true" />

So the web.config on the developer’s desktop should not have the tag and the DEV/QAS and Prod web.config files should have it.

I also understand it is possible for developers to use IIS Express and then they could use SSL locally.

Timon answered 9/10, 2012 at 11:17 Comment(0)
K
0

What is the question? The session expired and they cannot continue.

Check the report process speed. Build in some kind of benchmark or simply ask them to measure the report processing.

Easily can be that it is working for you, but not for them (slower network, more data to handle, slower DB server, and so on).

Edit: Here is another explanaition and maybe a solution for the problem, but I don't recomment to set the worker process number to 1 on a procudtion environment.

Kibler answered 7/10, 2008 at 14:13 Comment(0)
B
0

web gardern count=1 Works for me

Bullen answered 8/3, 2012 at 9:47 Comment(0)
G
0

Check number of Maximum Worker Processes for Application Pool, because Asp NET Session is different for Worker Processes.

If you have more than 1 Worker Process and In-Process Sesion State then each process will have their own Session.

Sesion State Types

  1. In-process: Session state is stored in the worker process where the ASP.NET application runs.
  2. State Server: Session state is stored outside the worker process where the ASP.NET application runs.
  3. SQL Server: Session state is stored in a SQL Server database.
Govan answered 6/7, 2021 at 13:51 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.