Pass login credentials and password for report service

0

I have an application that is calling a Report Service report, I have taken an example from Microsoft to pass the credentials of who is logged in to windows, but the server has the specific login and password for it.

How do I set via password, the login and password that will be passed to the Report Service?

The code I'm using is this:

        reportViewer1.ProcessingMode = ProcessingMode.Remote;
        ServerReport serverReport = reportViewer1.ServerReport;

        NetworkCredential myCred = new NetworkCredential("user", "password");
        reportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = myCred;

        // Set the report server URL and report path  
        serverReport.ReportServerUrl = new Uri("http://localhost/reportserver");
        serverReport.ReportPath = "/caminho/nomeDoRelatorio";

        List<ReportParameter> listaParametro = new List<ReportParameter>();

        listaParametro.Add(new ReportParameter("Matricula", "351"));
        listaParametro.Add(new ReportParameter("Prefixo", "45072"));
        listaParametro.Add(new ReportParameter("SemanaIni", "201750"));

        reportViewer1.ServerReport.SetParameters(listaParametro);

        reportViewer1.RefreshReport();

Note: I updated the way to pass the parameters, but still it generates an unauthorized http: 401 error

    
asked by anonymous 16.01.2018 / 13:42

0 answers