reportviewercore icon indicating copy to clipboard operation
reportviewercore copied to clipboard

Server report

Open josecalcano opened this issue 1 year ago • 5 comments

Hello, good afternoon. I'm trying to make a call to a server report, and I want to add a header that specifies .Headers.Add("Accept", "text/html"), but it doesn't let me.

josecalcano avatar Mar 04 '24 21:03 josecalcano

Hi, this doesn't seem directly related to this project.

lkosson avatar Mar 05 '24 05:03 lkosson

In your project to have ServerReport report = new ServerReport(); report.ReportServerCredentials.NetworkCredentials = new NetworkCredential("login", "password", "DOMAIN"); report.ReportServerUrl = new Uri("http://localhost/ReportServer"); report.ReportPath = "/Invoice"; report.SetParameters(new[] { new ReportParameter("Date", DateTime.Now.Date.ToString()) }); byte[] pdf = report.Render("PDF");

I need add a header to a report to accept html format

josecalcano avatar Mar 05 '24 07:03 josecalcano

I don't really understand what are you trying to do.

lkosson avatar Mar 05 '24 07:03 lkosson

When I made your example when debugging the line of report.setparemters throw this exception System.ServiceModel.ProtocolException: 'The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.

josecalcano avatar Mar 05 '24 16:03 josecalcano

I see. That most likely means either your Reporting Services URL is invalid, it doesn't work properly, or there are some problems with authentication. Reporting Services shouldn't respond with text/html under any normal circumstances.

lkosson avatar Mar 06 '24 05:03 lkosson