I have a page where I'm simply trying to write a pdf to the screen. Here's what I'm doing:
protected void ViewPDF(string url)
{
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.TransmitFile(url);
Response.Flush();
Response.End();
}
This works in every browser and OS except for Firefox on Mac. Instead of displaying the pdf file in the browser, the browser opens the dialog to download the file, where you can Open it or Save it.
I've also tried this:
protected void ViewPDF(string url)
{
Response.Clear();
Response.ContentType = "application/pdf";
string path = Server.MapPath(url);
byte[] data = File.ReadAllBytes(path);
Response.BinaryWrite(data);
Response.End();
}
And I get the same result.
Anyone know how to fix this?