I write a file download method to download file from server to client machine in C# asp.net
I wrote the following code:
Response.ContentType = ReturnExtension(System.IO.Path.GetExtension(file.Name));
Response.AppendHeader("Content-Disposition", "attachment;开发者_开发知识库 filename=" + file.Name);
Response.TransmitFile(strRequest);
Response.End();
This will work fine in Firefox and Chrome, but not in IE.
I was facing similar issue in some versions of IE and had to set Cache-Control header to make the download working properly:
response.Cache.SetCacheability(HttpCacheability.Private);
try to put a Response.Clear()
on top of your code.
精彩评论