Category / Section
How to pass data source or server credentials to the server side?
Published:
Updated:
This section explains how to pass data source or server credentials to the server side.
You can specify ReportServerCredential
in the Web API Controller OnInitReportOptions
method, as shown in the below snippet to connect to your SSRS
server.
public void OnInitReportOptions(ReportViewerOptions reportOption)
{
reportOption.ReportModel.ReportServerCredential = new System.Net.NetworkCredential("ssrs", "RDLReport1");
}
If the report has any data source that uses credentials, you must specify the DataSourceCredentials
in the Web API Controller OnInitReportOptions
method as shown in the below snippet to connect data-source.
reportOption.ReportModel.DataSourceCredentials.Add(new BoldReports.Web.DataSourceCredentials("AdventureWorks", "ssrs1", "RDLReport1"));