Response.ContentType = "Application/pdf";
Response.TransmitFile(pdfReport.Location + pdfReport.FileName);
In IE browser to disable the Open or Save dialogue prompt and view to tag withour PDF Viewer plugin.
Problem Streaming PDF File to IE Browsers-does not have the pdf pluggin in Transmitfile without pdf viewer pluggin.
Thanks in advance.
What I have tried:
if ((Request.Browser.Type.Contains("InternetExplorer")))
{
Response.AppendHeader("Content-Disposition", "FirstCloseReport; filename=" + pdfReport.FileName);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/pdf";
Response.Write(pdfReport.Location + pdfReport.FileName);
Response.Flush();
Response.End();
}
Response.End();
解决方案PDF.js[^]
It's the same PDF viewer that's built in to Firefox.
Quote: Response.Write(pdfReport.Location + pdfReport.FileName);
That's going to write a string to the response with the path of the report file. That string is not a valid PDF file. You probably meant to use either WriteFile[^] or TransmitFile[^] instead.