ASP.net. Mime type of a downloaded file not detected by browser

I'm trying to return a PDF file in asp.net just by returning File(). The contents of my File are as expected except its MIME type which is not recognized by the browser. I wonder what could be the workaround with this.The users want to see the pdf on the fly with the browser internal viewer, but without the correct MIME tipe that doesn't seem to be possible.

this is how I return the PDF.

return File(pdfBytes, "application/pdf", "Reporte" + nVista + ".pdf");

And this is firefox uncapable of recognizing its type. Same thing with chrome.

this is not an HTML document

链接地址: http://www.djcxy.com/p/46934.html

上一篇: 在python中使用模式匹配获取文件扩展名

下一篇: ASP.net。 浏览器未检测到下载文件的MIME类型