Chrome, pdf display, Duplicate headers received from the server

The solution above is fine if you don't need to specify the filename, but we wanted to keep the filename default specified for the user.

Our solution ended up being the filename itself as it contained some commas. I did a replace on the commas with "" and the file now delivers the document as expected in Chrome.

FileName = FileName.Replace(",", "")

Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment; filename=" & FileName)    
Response.BinaryWrite(myPDF)

Had this problem today. Per roryok and others, the solution was to put the filename in quotes.

Previous, Chrome FAIL:

header("Content-Disposition: attachment; filename=$file");

Current, Chrome OK:

header("Content-Disposition: attachment; filename='$file'");

Note the quotes around $file.


I used @roryok's comment, wrapping the filename in quotes:

Response.AddHeader("content-disposition", "attachment; filename=\"" + FileName + "\"")

@a coder's answer of using single quotes did not work as expected in IE. The file downloaded with the single quotes still in the name.