[英]Content-Disposition Filename not working on IE
I am working on an asp.net/c# web application that allows users to view and download PDF files.我正在开发一个允许用户查看和下载 PDF 文件的 asp.net/c# web 应用程序。 When I am clicking on a file, I get to view that in the PDF reader available in the browser, and when I save it, the file should be saved with the name that I have passed via headers.
当我点击一个文件时,我可以在浏览器中可用的 PDF 阅读器中查看它,当我保存它时,文件应该以我通过标题传递的名称保存。 But this is not the behavior in IE7 & IE8
但这不是 IE7 和 IE8 中的行为
FileInfo f = new FileInfo(FileName);
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "inline; filename=" + f.Name)
When I click to save a file, the filename that I am sending over is not being used to save the file, but the filename of the aspx page in the url is being taken.当我点击保存文件时,我发送的文件名没有用于保存文件,而是使用了 url 中 aspx 页面的文件名。 Is this is a bug in IE.
这是 IE 中的错误吗? Everything works fine when I try it on Google chrome.
当我在谷歌浏览器上尝试时一切正常。
Try Response.AddHeader("Content-Disposition", "attachment;filename=\\"" + f.name + "\\"");
尝试
Response.AddHeader("Content-Disposition", "attachment;filename=\\"" + f.name + "\\"");
Inline is not working under IE 7-8.内联在 IE 7-8 下不起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.