How to Stop Report Viewer Javascript Auto-Refresh (independent of AutoRefresh property)?
The question: How to turn off the report viewer javascript that runs the setTimeout() method? The scenario:We have a webforms app that has an SSRS wrapper aspx page that runs the report viewer. We are using forms authentication set at timeout=15 minutes. When we run a report, and let the browser remain inactive for over 15 minutes (enough for forms auth to timeout) we are still authenticated and can navigate around the app. We found that the report viewer has javascript location.replace(setTimeout("/Reserved.ReportViewerWebControl.axd?blah", 539000)) that is refreshing (by redirecting) the report every 9 minutes making the app to not timout when no-one is using the app.We're getting this behavior when running the report in the SSRS Report Manager completely outside of our web app. We have not set the AutoRefresh property on the report, the AutoRefresh xml tag in the .rdl does not exist, so by default there should be no auto-refresh. To test, I set the AutoRefresh property to 12 minutes and found that it does auto-refresh every 12 minutes, but it also continues to auto-refresh every 9 minutes. So to reiterate the question, how do we stop the report viewer from auto-refreshing independent of the AutoRefresh property? Thanks!
January 25th, 2010 11:43pm

Hi Tim,By default, the Report Viewer will auto refresh in a specified time to keep session alive as you mentioned.We can set the default time out value from the Report Manager:1.Open Report Manager(http://<server>:<port>/reports )2.Click the "Site Settings" from the navigation.3.Set the item "Limit report execution to the following number of seconds".In this case, we can set it to be the same value of Forms Authentication time out.Thanks,Jin ChenJin Chen - MSFT
Free Windows Admin Tool Kit Click here and download it now
January 27th, 2010 11:36am

What about keep alive call of report viewer which it sends just before the session time out value. Because we are not using form authentication so no cookies are there.We have mentioned session time out value in config file but its not getting time out ever even after trying out above mentioned solution.
August 26th, 2010 10:49pm

Problem Definition: In Visual Studio 2008, the report viewer control (9.0.0) postbacks periodically to keep the session alive. This does not allow ASP.Net session timeout. Visual Studio 2008 report viewer control (9.0.0) does not expose the property "KeepSessionAlive" which is there in Visual Studio 2010 report viewer(10.0.0). This property is used to postback to the server for keeping the session alive. In 2010, this property is true by default. Solution: In VS2008, you can handle this code by interrupting request and identifying the source, whether reportviewer postbacks or page postbacks. Request is validated using Application_PreRequestHandlerExecute method of the global.asax file. public class Global : System.Web.HttpApplication { protected void Application_PreRequestHandlerExecute(object sender, EventArgs e) { try { // Determine request source //1. Webform i.e. aspx page //2. Any other resource requested. for e.g gif,js,css,jpg //3. Whether this request is generated from report viewer using refrsh button //4. whether it is auto-generated for keeping session alive. if((!Request.Url.ToString().Contains("Reserved.ReportViewerWebControl.axd") && Request.Url.ToString().Contains(".aspx")) || (Request.Url.ToString().Contains("Reserved.ReportViewerWebControl.axd") && !Request.Url.ToString().Contains ("&OpType=SessionKeepAlive") ) ) { // Make a dummy datetime variable to explicitely store last user request. if (Session["LastRequestDateTime"] != null) { // If the time elapsed is greater than Session Timeout, explicitely clear the session, forcing it to timeout. // Else update the dummy session variable. if ((DateTime)Session["LastRequestDateTime"] > DateTime.Now.AddMinutes(-Session.Timeout)) { Session["LastRequestDateTime"] = DateTime.Now; } else { Session.Clear(); } } else { Session["LastRequestDateTime"] = DateTime.Now; } } } catch (Exception ex) { // As non .Net resouces (gif,js,css,jpg) does not provide session object in context. if (ex.Message != "Session state is not available in this context.") { // Error logging logic throw ex; } } } } This should work well !!!
Free Windows Admin Tool Kit Click here and download it now
November 3rd, 2010 3:09am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics