Reporting Services 2008中的自定义错误页面

时间:2021-03-30 08:17:36

I'd like to re-brand (and send error emails) for all of the SSRS default error pages (picture below) when you access reports via /ReportServer/. I'm already handling the ASP OnError event and some of the default SSRS errors appear to catch their own exceptions and then render this page cancel the response all before the OnError event is ever fired.

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

Any idea on how I can get a handle into SSRS to brand all error pages?

有关如何处理SSRS以标记所有错误页面的任何想法?

Reporting Services 2008中的自定义错误页面

3 个解决方案

#1


1  

Unfortunately, you can't when using the visual aspects of SSRS. You can if you consume the reports directly via SOAP and the web service.

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

#2


1  

I had a similar problem and came up with the following solution. It's prone to breaking things if Microsoft changes this particular method. The following code would be added to the header of the page to make sure it runs after the ReportViewer javascript is loaded, but before an instance of the RSClientController is created.

我有类似的问题,并提出了以下解决方案。如果微软改变这种特殊方法,它很容易破坏。以下代码将添加到页面的标题中,以确保它在加载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;

The original code from the Microsoft ReportViewer script file (inside the Microsoft.ReportViewer.WebForms, 8.0.0.0, .Net Framework 3.5 SP1) is:

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


1  

i created this solution for SSRS2005 and 2008. below is 2008r2 version

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

in reportviewer.aspx, add right before </form>

在reportviewer.aspx中,在 之前添加

<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>

#1


1  

Unfortunately, you can't when using the visual aspects of SSRS. You can if you consume the reports directly via SOAP and the web service.

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

#2


1  

I had a similar problem and came up with the following solution. It's prone to breaking things if Microsoft changes this particular method. The following code would be added to the header of the page to make sure it runs after the ReportViewer javascript is loaded, but before an instance of the RSClientController is created.

我有类似的问题,并提出了以下解决方案。如果微软改变这种特殊方法,它很容易破坏。以下代码将添加到页面的标题中,以确保它在加载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;

The original code from the Microsoft ReportViewer script file (inside the Microsoft.ReportViewer.WebForms, 8.0.0.0, .Net Framework 3.5 SP1) is:

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


1  

i created this solution for SSRS2005 and 2008. below is 2008r2 version

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

in reportviewer.aspx, add right before </form>

在reportviewer.aspx中,在 之前添加

<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>