I use Controller.File(Stream fileStream, String contentType, String fileDownloadName)
Method to download a file from server. In my case contentType
is application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
. I do specify some special name for the file in fileDownloadName
argument. And it works pretty well in Firefox, Opera, IE9.
However, IE8 returns the name of the action instead of the name I specify. It looks like Download.xlsx
, if the url is ../Report/Download
.
Why is that so and what can I do about that?
According to Content-Disposition headers in .NET the overload I'm using should solve the issue. However IE8 wants the file download name to be encoded. While, when encoded with HttpUtility.UrlPathEncode
for example, Firefox starts showing the file name encoded.
Is there a universal solution in the end?