I'm having a problem connecting to the 2014 Report Service via C # from an MVC4 project:
Scenery:
- A 2014 Report Service Server was installed that will have numerous reports, due to the client having numerous SQL Server databases spread across the state of SP. the most viable Solution was this because in the Report Server we have how to add several tals connections (DataSources).
So far, okay.
Problem:
-
There is an MVC5 application that will have a list of these reports, where the Client (user) will open tals to see. The question is "Can not connect to the Report Service Server", the error is:
The 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"); }