Welcome! Log In Create A New Profile

Advanced

Error 349: Duplicate headers received from server

Posted by eddym 
Error 349: Duplicate headers received from server
March 29, 2012 08:27AM
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?
Re: Error 349: Duplicate headers received from server
March 29, 2012 01:46PM
What are the full response headers you are getting?
Re: Error 349: Duplicate headers received from server
March 29, 2012 02:21PM
I'm not sure how to go about finding those
Re: Error 349: Duplicate headers received from server
March 29, 2012 03:10PM
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.
Re: Error 349: Duplicate headers received from server
March 29, 2012 03:59PM
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
Re: Error 349: Duplicate headers received from server
March 29, 2012 05:51PM
Please could you describe how we can replicate this issue? What Chrome version are you using?
Re: Error 349: Duplicate headers received from server
March 29, 2012 06:06PM
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
Re: Error 349: Duplicate headers received from server
April 01, 2012 04:13AM
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?
Sorry, only registered users may post in this forum.

Click here to login