2008-10-09 129 views
3

當您通過/ ReportServer /訪問報表時,我想重新標記所有SSRS默認錯誤頁面(併發送錯誤電子郵件)(如下圖所示)。我已經在處理ASP OnError事件,並且默認的SSRS錯誤的一些似乎捕獲它們自己的異常,然後在OnError事件被觸發之前使這個頁面全部取消響應。Reporting Services 2008中的自定義錯誤頁面

有關如何獲得SSRS句柄來標記所有錯誤頁面的任何想法?

Reporting Services Error

回答

1

不幸的是,你可以使用SSRS的視覺方面不用時。如果您直接通過SOAP和Web服務使用報告,則可以。

1

我有一個類似的問題,並提出了以下解決方案。如果微軟改變這種特殊方法,很容易破壞事情。以下代碼將被添加到頁面的頁眉中,以確保它在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; 

從微軟的ReportViewer腳本文件中的原始代碼(Microsoft.ReportViewer.WebForms,裏面8.0.0.0,.Net框架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; 
1

我創造了這個解決方案SSRS2005以下是2008年版本2008R2

在reportviewer.aspx

,前加右</form>

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