This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Error 349: Duplicate headers received from server

eddym wrote on 2012-03-29:
While I have successfully set up generating a PDF from HTML in Internet Explorer, the same website returns the following error in Chrome:

Duplicate headers received from server
The response from the server contained duplicate headers. This problem is generally the result of a misconfigured website or proxy. Only the website or proxy administrator can fix this issue.
Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple Content-Disposition headers received. This is disallowed to protect against HTTP response splitting attacks.

Is there anything I can do to fix the issue, or this due or is it because the header field in the response from your server is not enclosed in quotation marks or similar?
support wrote on 2012-03-29:
What are the full response headers you are getting?
eddym wrote on 2012-03-29:
I'm not sure how to go about finding those
support wrote on 2012-03-29:
In Chrome, hit Ctrl+Shift+I and go to the Network tab. Now if you make a request you can click its URL in the Network tab to see the headers.
eddym wrote on 2012-03-29:
All I can see is the following:

GET data:text/html,chromewebdata HTTP/1.1

User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.83 Safari/535.11
support wrote on 2012-03-29:
Please could you describe how we can replicate this issue? What Chrome version are you using?
eddym wrote on 2012-03-29:
I'm using Chrome 17.0.963.83 at present.

This is the method I'm calling, which is working fine in other browsers:

Dim Response As System.Web.HttpResponse = System.Web.HttpContext.Current.Response

Try

' create an API client instance
Dim clientPdfCrowd As New pdfcrowd.Client("*****", "*******")

' convert a web page and write the generated PDF to a memory stream
Dim Stream As New System.IO.MemoryStream
' set properties of the PDF
' page-break-after and page-break-before do not work when used in a table or inside a floating element or inside an element which is set to overflow:hidden.
'' clientPdfCrowd.setDefaultTextEncoding("")
clientPdfCrowd.setPageLayout(2) ' 1 = single page, 2 = continuous, 3 = continuous side by side
'' clientPdfCrowd.setPageHeight(-1) ' -1 = one long page
clientPdfCrowd.setInitialPdfExactZoom(100)
clientPdfCrowd.setPageBackgroundColor("CCCCCC")
clientPdfCrowd.setPageWidth(560)
'' clientPdfCrowd.setHeaderHtml("<p>Philips Lighting Centre Visits</p>")

' perform the conversion
clientPdfCrowd.convertHtml(strContent, Stream)

' set HTTP response headers
Response.Clear()
Response.AddHeader("Content-Type", "application/pdf")
Response.AddHeader("Cache-Control", "no-cache")
Response.AddHeader("Accept-Ranges", "none")
Response.AddHeader("Content-Disposition", "attachment; filename=" & strFileName)

' send the generated PDF
Stream.WriteTo(Response.OutputStream)
Stream.Close()
Response.Flush()
Response.End()

Catch ex As pdfcrowd.Error
MessagesClass.RecordError("GeneratePDF pdfcrowd error", ex.ToString())
End Try
support wrote on 2012-04-01:
Actually, the headers the browser receives are those "Response.AddHeader(..)" sent by your code. I would try the following:

  1. Enclose strFileName within double quotes, i.e. "attachment; filename=""" & strFileName & """. It is possible that strFileName contains some offending characters.
  2. If this does not help try to do not send the "Content-Disposition" header at all.


Does this help?