5
votes

My code is opening a PDF in a tab/new window using an .apsx page and the following code:

            string fileName = GetFileName(so);

            Response.Clear();
            Response.Buffer = true;
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "inline; filename=" + fileName);
            Response.BinaryWrite(pdfStream);

When selecting the save option in the browser for the PDF, the filename in the save dialogue is not being populated correctly in IE (11); it's still using the page name. Chrome and FF are working like I'd expect them too (using the provided filename as the suggested name).

In addition, IE works the same as Chrome and FF when i change the content-disposition to attachment instead of inline. They all use the filename as the suggested save name.

Am I missing something in how to use the inline functionality?

1
Same here in IE11.0.9600Ashfaq Hussain

1 Answers

0
votes

Did you try change inline to attachment ? Response.AddHeader("content-disposition", "attachment; filename=" + fileName);