Reporting services Reporting Services 2008中的自定义错误页
当您通过/ReportServer/访问报告时,我想为所有SSRS默认错误页面(下图)重新标记(并发送错误电子邮件)。我已经在处理ASP OnError事件,一些默认SSRS错误似乎捕获了它们自己的异常,然后呈现此页面,在触发OnError事件之前取消响应 有没有关于我如何进入SSR的句柄来标记所有错误页面的想法Reporting services Reporting Services 2008中的自定义错误页,reporting-services,error-handling,Reporting Services,Error Handling,当您通过/ReportServer/访问报告时,我想为所有SSRS默认错误页面(下图)重新标记(并发送错误电子邮件)。我已经在处理ASP OnError事件,一些默认SSRS错误似乎捕获了它们自己的异常,然后呈现此页面,在触发OnError事件之前取消响应 有没有关于我如何进入SSR的句柄来标记所有错误页面的想法 不幸的是,在使用SSR的视觉方面时,您不能。如果您直接通过SOAP和web服务使用报表,您可以这样做。我遇到了类似的问题,并提出了以下解决方案。如果微软改变这种特殊的方法,它很容易破坏
不幸的是,在使用SSR的视觉方面时,您不能。如果您直接通过SOAP和web服务使用报表,您可以这样做。我遇到了类似的问题,并提出了以下解决方案。如果微软改变这种特殊的方法,它很容易破坏东西。以下代码将添加到页面的标题中,以确保它在加载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;
我为SSRS2005和2008创建了这个解决方案。下面是2008r2版本 在reportviewer.aspx中,在
var rptDivString=document.getElementById('ReportViewerControl_ctl10_NonReportContent')。innerHTML;
//警报(rptDivString);
var numpermeror=rptDivString.search(/permissions/i);
如果(数值错误>0)
{
var docTitle=document.title;
var reportName=docTitle.substr(0,docTitle.length-16);
警报(“报告中的Reporting Services权限错误:”+reportName);
}
function OnReportFrameLoaded()
{
this.m_reportLoaded = true;
this.ShowWaitFrame(false);
if (this.IsAsync && this.m_reportObject != null)
this.m_reportObject.OnFrameVisible();
}
RSClientController.prototype.OnReportFrameLoaded = OnReportFrameLoaded;
<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>