【问题标题】:Custom error pages in Reporting Services 2008Reporting Services 2008 中的自定义错误页面
【发布时间】:2008-10-09 17:43:49
【问题描述】:

当您通过 /ReportServer/ 访问报告时,我想为所有 SSRS 默认错误页面(下图)重新命名(并发送错误电子邮件)。我已经在处理 ASP OnError 事件,一些默认的 SSRS 错误似乎捕获了它们自己的异常,然后呈现这个页面在 OnError 事件被触发之前取消响应。

知道如何获取 SSRS 的句柄以标记所有错误页面吗?

【问题讨论】:

    标签: reporting-services error-handling


    【解决方案1】:

    不幸的是,在使用 SSRS 的视觉方面时,您不能这样做。如果您直接通过 SOAP 和 Web 服务使用报告,则可以。

    【讨论】:

      【解决方案2】:

      我遇到了类似的问题,并提出了以下解决方案。如果 Microsoft 更改此特定方法,则很容易出现问题。以下代码将被添加到页面的标题中,以确保它在加载 ReportViewer javascript 之后但在创建 RSClientController 的实例之前运行。

      // This replaces a method in the ReportViewer javascript. If Microsoft updates 
      // this particular method, it may cause problems, but that is unlikely to 
      // happen.The purpose of this is to redirect the user to the error page when 
      // an error occurs. The ReportViewer.ReportError event is not (always?) raised 
      // for Remote Async reports
      function OnReportFrameLoaded() {
          this.m_reportLoaded = true;
          this.ShowWaitFrame(false);
      
          if (this.IsAsync)
          {
              if(this.m_reportObject == null)
              {
                  window.location = 
                      '<%= HttpRuntime.AppDomainAppVirtualPath %>/Error.aspx';
              }
              else
              {
                  this.m_reportObject.OnFrameVisible();
              }
          }
      }
      RSClientController.prototype.OnReportFrameLoaded = OnReportFrameLoaded;
      

      Microsoft ReportViewer 脚本文件(在 Microsoft.ReportViewer.WebForms、8.0.0.0、.Net Framework 3.5 SP1 内)的原始代码为:

      function OnReportFrameLoaded()
      {
          this.m_reportLoaded = true;
          this.ShowWaitFrame(false);
      
          if (this.IsAsync && this.m_reportObject != null)
              this.m_reportObject.OnFrameVisible();
      }
      RSClientController.prototype.OnReportFrameLoaded = OnReportFrameLoaded;
      

      【讨论】:

        【解决方案3】:

        我为 SSRS2005 和 2008 创建了这个解决方案。下面是 2008r2 版本

        在reportviewer.aspx中,在&lt;/form&gt;之前添加

        <script type="text/javascript">
        var rptDivString=document.getElementById('ReportViewerControl_ctl10_NonReportContent').innerHTML;
        //alert( rptDivString );
        var numPermError = rptDivString.search(/permissions/i);
        if (numPermError>0)
        {
        var docTitle = document.title;
        var reportName = docTitle.substr(0,docTitle.length-16);
        alert('Reporting Services permissions error in report: ' +  reportName );
        }
        </script>
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2010-09-15
          • 1970-01-01
          相关资源
          最近更新 更多