Why Does FireFox Not Include the .xml Extension when Downloading a File?

不打扰是莪最后的温柔 提交于 2019-12-05 12:17:17

Try changing:

response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);

To:

response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName));

The code works for all browsers (including Firefox which we use heavily).

christian Kimbi

Solved the firefox spaces problems. Surround your filename with quotes.

Change the code below

response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);

to

response.AddHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");

Does your filename have space in it? Firefox may have problem with that.

See this blog post for more details:

http://blog.mjjames.co.uk/2009/04/content-disposition-in-different.html

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