THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Roman Rehak

'ASP.NET session has expired' error in the ReportViewer control

I deployed an ASP.NET  application to another server and the page that includes a few ReportViewer controls started showing the "ASP.NET session has expired" error in each report. The same web app worked totally fine on my box. I didn’t have time to investigate before I moved on to other work and then a few days later I came across a solution to the problem by accident when reading a KB article related to RS security on They suggested changing the AsyncRendering property to false. Since there are some performance penalties when turning off asynchronous rendering, I decided to make it a setting in Web.config and turn it off only if needed:


      bool asyncRendering = bool.Parse(ConfigurationManager.AppSettings.Get("AsyncRendering"));
      rptvAverageOrder.AsyncRendering = asyncRendering;

After I tried that, the error went away but I ended up with another issue. Reports with images (in my case charts) ended up having a missing image with that ugly placeholder with an X in it. I did some googling and found out that this can happen if asynchronous rendering in ReportViewer is off and the server name contains an underscore as it does in my case so these two issues are related. When I use the IP address or "localhost" in the URL, everything works fine regardless of how this property is set. Also, some people pointed out is that if you turn off asynchronous rendering, reports get messed up when viewed with Firefox. I will report this as an issue on Microsoft Connect and I guess in the meantime we have to avoid deploying ReportViewer applications on servers with underscores in their names.


Published Friday, May 4, 2007 12:20 PM by roman



Anonymous Coward said:

Man, that is a *painful* font.

May 8, 2007 3:44 PM

roman said:

Believe it or not, that's my default font in Outlook 2007, that's where I write my entries and then just paste them here. I changed it to something more normal.

May 8, 2007 7:09 PM

G.V.Senthilkumar said:

When I set When cookieless="true" then I got the error in my report page ..." session expired". After than I changed the parameter cookieless="False",Then my report is working fine.But some of the other page Images is not loaded properly.I am getting page images its shown and some of the images is not shown.I unable to find the reason.

Can you help me.

August 28, 2007 10:12 AM

Sam Ranjbari said:

set this in web.config

<sessionState timeout ="120" mode="InProc" cookieless="true" />

May 30, 2008 2:55 PM

Chris May said:

I started getting this error on our report viewer also.

I am wondering if it is related to some changes where we increased the number of worker processes on the webserver.

If anyone has any other info, I would be interested.

June 3, 2008 1:00 PM

Vinod_Yadav1919 said:

Hii Roman Rehak!!

Even for our application we got the same error, and finally resolved by following the solution provided in this link.

November 4, 2008 10:46 PM

Siva Pittu said:


I am still facing the session expired for Report viewer control. I developed it using VS2008 and deployed it on the WebFarm environment. Session State is InProc and timeout is 120 Minutes but still the Report Viewer control is giving error. Any help is greatly appreciated.

May 13, 2009 6:14 AM

Online Business said:

May 15, 2009 9:48 AM

Abhishek Balne said:

Hi All,

I had the same problem. Whenever, I clicked on the nextPage button on the report viewer, I would get an error " session has expired".

Server Error in '/' 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.

The problem was an image in the Report. When I took the report to production, I forgot to take the image that was embed in the report. When I uploaded the image to the production server, the report was now able to find the image and everything seemed to work fine.

Hope this helps.


July 22, 2009 5:14 PM

retreter said:


August 5, 2009 7:29 AM

retreter said:

576577677 65 fgfhgfhgfhfghfghfhfh

August 5, 2009 7:29 AM

MTReg said:

You are wonderful.  I have been researching this for a month.  I finally found that the combination of setting AsyncRendering to False and the mode in web config to InProc worked.  We are using report viewer in a sharepoint web part.

August 26, 2009 4:48 PM

Brilliant Logic said:

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.

September 21, 2010 1:09 PM

Doug Thomson said:

During testing a while ago I had changed the "Maximum Worker Processes" (in the advanced settings of the application pool) to a value greater than 1 - this was causing multiple W3WP.Exe's to be launched which of course weren't sharing memory so inProc session state was failing.

Changing the Maximum Worker Processes back to 1 cured my problem.

Thanks to "Brilliant Logic"  for pointing me in the right direction

November 25, 2010 7:38 AM

Vikas said:

Nice article

June 1, 2012 3:31 PM

Report viewer error :- session has expired or could not be found said:

Hi Charles,

This is the request we are sending to Microsoft support as first step.

I am using Report Viewer control in web application.[ReportViewer version 11].The applications sessionstate mode is set to InProc as follows

<sessionState mode="InProc" cookieless="false" timeout="20" /> [I cannot change the sessionstate mode and cookiless properties]

The report viewer is running with multiple worker process. I have implemented IReportServerConnection interface. I am passing username, password, domain name and server url via web config file to IReportServerConnection interface.

When I click on a button and try to connect to the SSRS report server to fetch data, I get ASP.Net session has expired or could not be found error message on reportviewer control.

Web.config file entries are as below.


 <add assembly="Microsoft.ReportViewer.Common, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />



 <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />



    <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />


January 17, 2014 12:37 AM
New Comments to this post are disabled
Privacy Statement