We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Report Viewer Promps Username and Password

Hello


The Report Viewer is prompting for Username and Password for a RDL created with Bold Report Designer.

I have specified 

 reportOption.ReportModel.DataSourceCredentials.Add.....



3 Replies

AM Arumugasami Murugesan Syncfusion Team October 17, 2022 03:19 AM

Hi Samson,


Thanks for contacting Bold Report support.


you can add the connection string programmatically in the API controller in the OnInitReportOptions method. You need to use the below code snippet to pass the data source credentials.


  [NonAction] 

public void OnInitReportOptions(ReportViewerOptions reportOption) 

{ 

        reportOption.ReportModel.DataSourceCredentials.Add(new BoldReports.Web.DataSourceCredentials() { Name = "AdventureWorks",    ConnectionString = "Data Source=dataplatformdemodata.syncfusion.com;Initial Catalog=AdventureWorks;" , UserId = "demoreadonly@data-platform-demo" , Password = "N@c)=Y8s*1&dh"}); 

} 


Please refer to the below documentation for your reference.

https://help.boldreports.com/embedded-reporting/aspnet-core-reporting/report-viewer/ssrs-report/#change-data-source-connection-string

https://help.boldreports.com/embedded-reporting/how-to/change-the-report-datasource-dynamically/


Regards,

Arumugasami M



SA Samson October 17, 2022 03:25 AM

Hello


Thanks for the reply,. I tried this and it worked.

However when I migrated the reports to another Database, I was forced to change the Datasource connection settings on the designer for the reports to work, is that the case or there is another way.



AM Arumugasami Murugesan Syncfusion Team October 18, 2022 04:30 AM

Hi Samson,


Thanks for the update,


Yes, we will be forced to change the data source connection string, which is in the API controller in the OnInitReportOptions method. The report viewer will preview without a prompt only if you use the data source connection string programmatically.

Otherwise, you have to give the username and password credentials in the connection string in advanced options and set the Authentication Type to None. Please have a look at the below snap for your reference.


SNAP:


Regards,

Arumugasami M.


Loader.
Live Chat Icon For mobile
Up arrow icon