Response Writefile isn't creating a PDF when using Chrome

1.6k Views Asked by At

I'm using the following code to send a PDF to users to open/download. This works fine in IE9. Any ideas why it won't work in Chrome?

Response.Clear();

Response.AddHeader("Content-Disposition", "attachment; filename= \"" + myFile + "\"");
Response.AddHeader("Content-Length", myFile.Length.ToString());

Response.WriteFile(myFile.FullName);

Response.Flush();
Response.End();
1

There are 1 best solutions below

2
On BEST ANSWER

Add this:

Response.ContentType = "application/pdf";