Reserved.ReportViewerWebControl.axd cookie积累

时间:2013-05-13 11:13:25

标签: c# asp.net reportviewer

我遇到了Microsoft ReportViewer的问题。 每个新生成的报告都会添加一个新的Cookie:/Reserved.ReportViewerWebControl.axd%3FOpType%3DSessionKeepAlive%26ControlID%3Df6166329be5f4b00aa32320285ffaf55_SKA 直到服务器开始出现Bad Request - Request too long错误,因为请求中包含太多cookie。 我已经尝试手动使这些cookie过期,但没有成功。 我的报告查看器的初始化代码:

var credentials = new ReportViewerCredentials { NetworkCredentials = System.Net.CredentialCache.DefaultCredentials};            
           mainReportViewer.ServerReport.ReportServerCredentials = credentials;
           mainReportViewer.ProcessingMode = ProcessingMode.Remote;
           mainReportViewer.ReportError += OnReportError;
           mainReportViewer.ShowRefreshButton = false;
           mainReportViewer.ShowWaitControlCancelLink = false;
           mainReportViewer.ShowBackButton = false;
           mainReportViewer.ShowCredentialPrompts = false;
           mainReportViewer.AsyncRendering = true;
           mainReportViewer.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportServerUrl"]);
           ExtractReportParametersFromCookie(mainReportViewer);
           mainReportViewer.ServerReport.Refresh();

Web.Config:

<system.web>
      <httpHandlers>
        <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false" />
      </httpHandlers>
      <compilation debug="true" targetFramework="4.5">
        <assemblies>
          <add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
          <add assembly="Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
          <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        </assemblies>
        <buildProviders>
          <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
        </buildProviders>
      </compilation>
   </system.web>
   <system.webServer>
      <handlers>
         <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*"  path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
      </handlers>
   </system.webServer>

也许有人有想法如何解决这个问题?

1 个答案:

答案 0 :(得分:3)

似乎KeepSessionAlive="False"解决了这个问题,可以用作解决方法。