Search results

Load SSRS Report Server reports

Report Viewer has support to load RDL reports from SSRS Report Server. To render SSRS Reports, set the ReportServerUrl, ReportPath, and ReportServiceUrl properties as shown in the following code snippet.

@(Html.Bold().ReportViewer("viewer")
    .ReportServiceUrl("/api/SSRSReports")
    .ReportServerUrl("http://<servername>/reportserver$instanceName")
    .ReportPath("/SSRSSamples2/Territory Sales new")
)

Report Server URL should be in the format of http://<servername>/reportserver$instanceName The report path should be in the format of /folder name/report name.

Network credentials for SSRS

The network credentials are required to load specified SSRS report from the specified SSRS Report Server using the Report Viewer. Specify the ReportServerCredential property in the Web API Controller OnInitReportOptions method.

public void OnInitReportOptions(ReportViewerOptions reportOption)
{
    //Add SSRS Report Server credential
    reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1");
}

Set data source credential to shared data sources

The SSRS Report Server does not provide options to get credential information of the report data source deployed on the SSRS Server. If the report has any data source that uses credentials to connect with the database, then you should specify the DataSourceCredentials for each report data source to establish database connection.

public void OnInitReportOptions(ReportViewerOptions reportOption)
{
    //Add SSRS Report Server and data source credentials
    reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1");

    reportOption.ReportModel.DataSourceCredentials.Add(new BoldReports.Web.DataSourceCredentials("AdventureWorks", "ssrs1", "RDLReport1"));
}

Data source credentials should be added to the shared data sources that do not have credentials in the connection strings.

Render linked reports

You can render a linked report that points to an existing report, which is published in the SSRS Report Server. You can set the parameter, data source, credential, and other properties like normal SSRS reports using the Report Viewer.

@(Html.Bold().ReportViewer("viewer")
    .ReportServiceUrl("/api/SSRSReports")
    .ReportServerUrl("http://<servername>/reportserver$instanceName")
    .ReportPath("/SSRSSamples/Territory Sales_Link")
)

The Territory Sales_Link is a linked report created for the Territory Sales report that is already available in the SSRS Report Server.