Link to home
Start Free TrialLog in
Avatar of rohitnet100
rohitnet100

asked on

Client found response content type of '', but expected 'text/xml'.

I goet this error when trying to execute my SSRS reports.
Client found response content type of '', but expected 'text/xml'.
The request failed with an empty response.
VB Code:
Private Sub btnprint_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnprint.Click
        'RenderPDF()

        Dim rview As New Microsoft.Reporting.WebForms.ReportViewer()
        Dim apr As New AppSettingsReader()
        rview.ServerReport.ReportServerUrl = New Uri(apr.GetValue("ReportServer", GetType(String)))
        Dim paramList As New System.Collections.Generic.List(Of Microsoft.Reporting.WebForms.ReportParameter)()
        paramList.Add(New Microsoft.Reporting.WebForms.ReportParameter("@DateServed", RadDatePick.SelectedDate))
        paramList.Add(New Microsoft.Reporting.WebForms.ReportParameter("@Location", ddlSch.SelectedValue))
        paramList.Add(New Microsoft.Reporting.WebForms.ReportParameter("@MenuType", ddlmenutype.SelectedValue))

        rview.ServerReport.ReportPath = "/ReportFolder/ReportName"
        rview.ServerReport.SetParameters(paramList)

        Dim mimeType As String = Nothing
        Dim encoding As String = Nothing
        Dim extension As String = Nothing
        Dim deviceInfo As String = Nothing
        Dim streamIds As String() = Nothing
        Dim warnings As Microsoft.Reporting.WebForms.Warning() = Nothing
        Dim format As String = "PDF"

        deviceInfo = "<DeviceInfo>" + "<SimplePageHeaders>True</SimplePageHeaders>" + "</DeviceInfo>"
        Dim bytes As Byte() = rview.ServerReport.Render(format, deviceInfo, mimeType, encoding, extension, streamIds, warnings)
        Response.Clear()

        If format = "PDF" Then
            Response.ContentType = "application/pdf"
            Response.AddHeader("Content-disposition", "filename=output.pdf")
        End If

        Response.OutputStream.Write(bytes, 0, bytes.Length)
        Response.OutputStream.Flush()
        Response.OutputStream.Close()
        Response.Flush()
        Response.Close()
    End Sub
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rohitnet100
rohitnet100

ASKER

Hi carl,

I made these changes still, i got same error.
Thanks.