Content-Disposition Filename not working on IE

核能气质少年 提交于 2019-12-10 13:40:13

问题


I am working on an asp.net/c# web application that allows users to view and download PDF files. 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. But this is not the behavior in 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. Is this is a bug in IE. Everything works fine when I try it on Google chrome.


回答1:


Try Response.AddHeader("Content-Disposition", "attachment;filename=\"" + f.name + "\""); Inline is not working under IE 7-8.



来源:https://stackoverflow.com/questions/19299222/content-disposition-filename-not-working-on-ie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!