Reporting services 2005 is an amazing reporting tool with a lot of dependency on IIS. Recently I came across an interesting scenario where the reports in the native mode and the SharePoint integration mode were showing stale data. There were couple of issues that I faced.
1. There was a report with a multi-valued parameter. When the user ran the report for the first time, the report came up with the correct data. But later, when the user changed the value of the multi-valued parameter and then tried to view the report, the data was stale and did give the correct output.
2. From an ASP.NET Reportviewer application, the user entered the parameter data and then viewed it through a server side report. But when the user changed the parameter data and tried to view it though the same report, the user got the stale data.
Reporting Services uses browser sessions to maintain consistency while viewing reports. Sessions are based on browser connections, not authenticated users. A new session is created each time you open a report in a browser window. When a user refreshes a report or changes the parameter values and tries to view the report, Report server would serve the revised version of the report. So to retrieve the revised version, the report viewer control would use the session id.
For more information on Sessions in reporting services, you can take a look at the following link:
Whenever the user requests for a report or refreshes the report, the session id is appended to the URL.
Now coming back to stale data. Stale data will only be returned if the report is cached somewhere. Reporting services will never return stale data. Then who do we think is returning the stale data or where is the data getting cached?
1. Browser Cache
2. IIS cache
In the above 2 cases the culprit was a setting in IIS. The setting is called “max-age”. If this value is set to a specific value (It is number of seconds), the website or the web page is cached in the browser cache for that many number of seconds. Since reporting services is using the session id, the URL that is requested remains same for the request made by the user. That means even if the user changes the values of the parameters, the URL that would be requested would remain same. If the max-age is set and the same URL is being requested, the browser would pick the cached page and would return it. This would result in the stale data.
For more information on “max-age”, you can look at the following KB article:
In order to resolve the above issue, we need to set the max-age value to 0, so that the content expires immediately. You need to follow the following steps to set the max-age value to 0:
1. On your server, open a command prompt.
2. Change to your X:\InetPub\AdminScripts folder, where X is the drive that you specified for your IIS documents.
3. Run the following command:
CSCRIPT.EXE ADSUTIL.VBS SET W3SVC/Filters/Compression/Parameters/HcCacheControlHeader "max-age=0"
4. Stop and restart the IISAdmin service.
5. Restart the WWW service.
Gurpreet Singh - SSRS Support Engineer.
[All the posts are AS-IS with no warranty]