4
I’m having a problem connecting to the Report Service 2014 server via C# of an MVC4 project:
Setting:
- A Server Report Service 2014 has been installed that will have numerous reports, due to the client having numerous SQL Server bases spread throughout the state of SP. the most viable solution was this because in Report Server we have to add several tals connections (Datasources).
up to here ok.
Problem:
There is a MVC5 application that will have a list of these reports, where the Client (user) will open tals to see. The issue is "I cannot connect to the Report Service Server", the error is:
Remote server returned an error:
(401) Não Autorizado.
Ex: Code
public FileContentResult teste() { NetworkCredential Credential = new NetworkCredential("/USER/", "/PASS/"); WebClient client = new WebClient(); client.Credentials = Credential; string reportURL = "http://localhost/report/Pages/ReportViewer.aspx?/Relatorios/ColaboradoresRpt&rs:Command=Render&rs:Format=pdf"; return File(client.DownloadData(reportURL), "application/pdf"); }
I had a problem previously downloading a report. Check if you are not in the same situation
– Bruno Costa