Embedding report on C# ASP.NET page failing content type error?
All I'm trying to do is embed a report on a ASP.NET webpage using the Reportviewer control and add the parameters to it but I am getting the following error
Client found response content type of '', but expected 'text/xml'. The request failed with an empty response.
Here is my code
reportViewer.ProcessingMode = ProcessingMode.Remote;
reportViewer.ServerReport.ReportServerUrl = new Uri("http://devss370:14112/ReportServer/ReportExecution2005.asmx");// new Uri(ConfigurationManager.AppSettings["ReportServer"].ToString());
reportViewer.ServerReport.ReportPath = Request.QueryString["Report"].ToString();// +Server.HtmlDecode(Request.QueryString["reportPath"].ToString());
#region Get Parameters
string[] fullParamList = Server.HtmlDecode(Request.QueryString["reportPath"].ToString()).Split('&');
List<ReportParameter> reportParameters = new List<ReportParameter>();
foreach (string param in fullParamList)
{
if (param.Split('=').Count() == 2)
{
ReportParameter rp = new ReportParameter();
rp.Name = param.Split('=')[0];
rp.Values.Add(param.Split('=')[1]);
reportParameters.Add(rp);
}
}
reportViewer.ServerReport.Timeout = 90000;
reportViewer.ServerReport.SetParameters(reportP开发者_如何学JAVAarameters);
#endregion
reportViewer.DataBind();
And it always fails on the SetParameters line...
This has now wasted 7 hours of my life so if anyone can point out the blatantly obvious it would be awesome :)
reportViewer.ServerReport.SetParameters(reportParameters.toArray());
精彩评论