2010-10-19 135 views
0

查看有一個運行SSRS的中央報告服務器,我們的所有報告都已經構建並存在於服務器上。在ReportViewer控件中顯示SSRS報告

我該如何顯示使用ReportViewer Contontrol在ASP.NET中的報告之一?

我的控制:

我隱藏:

var reportServer = ctReportViewer.ServerReport; 
     reportServer.ReportServerUrl = new Uri(@"http://<MYSERVERNAMEHERE>/reportsdev"); 
     reportServer.ReportPath = @"/OneFm/ArrearCollectionPerRegion"; 
     reportServer.ReportServerCredentials = new ReportViewerCredentials("<USERNAME>", "<PASSWORD>", "<DOMAIN>"); 
     ctReportViewer.DataBind(); 

public partial class ReportViewerCredentials : IReportServerCredentials 
    { 
     private string _userName; 
     private string _password; 
     private string _domain; 

     public ReportViewerCredentials(string userName, string password, string domain) 
     { 
      _userName = userName; 
      _password = password; 
      _domain = domain; 

     } 


     public WindowsIdentity ImpersonationUser 
     { 
      get 
      { 
       return null; 
      } 
     } 

     public ICredentials NetworkCredentials 
     { 
      get 
      { 

       return new NetworkCredential(_userName, _password, _domain); 

      } 
     } 

     public bool GetFormsCredentials(out Cookie authCookie, 
       out string userName, out string password, 
       out string authority) 
     { 
      authCookie = null; 
      userName = _userName; 
      password = _password; 
      authority = _domain; 

      // Not using form credentials 
      return false; 
     } 
    } 

鏈接到報告:

http://<MYSERVERNAMEHERE>/ReportsDev/Pages/Report.aspx?ItemPath=/OneFm/ArrearCollectionPerRegion 

我已經搜查高和低。

我正在運行SSRS2005,並且我正在使用VS2008,如果這對任何事情都很重要。

一個例子真的很感激。

回答

0

管理弄明白感謝名單:

 var reportName = "SalesTargets" 
     ctReportViewer.ServerReport.ReportServerUrl = new Uri("http://<MYREPORTSERVER>/reportserverdev"); 
     ctReportViewer.ServerReport.ReportPath = @"/OneFm/" + reportName; 
     ctReportViewer.ProcessingMode = ProcessingMode.Remote; 
     ctReportViewer.ServerReport.Refresh(); 
     ctReportViewer.AsyncRendering = false; 
     ctReportViewer.SizeToReportContent = true;