lkosson / reportviewercore

Recompilation of Microsoft.ReportViewer for .NET Core 3.1+
427 stars 123 forks source link

Server report #177

Closed josecalcano closed 1 month ago

josecalcano commented 8 months ago

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.

lkosson commented 8 months ago

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

josecalcano commented 8 months ago

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

lkosson commented 8 months ago

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

josecalcano commented 8 months ago

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.

lkosson commented 8 months ago

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.