Internet explorer 如何让Internet Explorer将此响应保存为文件?

Internet explorer 如何让Internet Explorer将此响应保存为文件?,internet-explorer,asp.net-web-api,download,asp.net-web-api2,Internet Explorer,Asp.net Web Api,Download,Asp.net Web Api2,我在WebAPI2 web服务中有以下代码: ... var resp = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StreamContent(new MemoryStream(byte_data)) }; resp.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); resp.Content.H

我在WebAPI2 web服务中有以下代码:

...
var resp = new HttpResponseMessage(HttpStatusCode.OK) {
    Content = new StreamContent(new MemoryStream(byte_data))
};
resp.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
resp.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment") {
    FileName = "MyFile.csv"
};

return resp;
在Firefox和Chrome中,该文件(正确)保存为下载位置的.csv文件。在IE中,它打开了一个空白页,没有做任何我能说的事情;在开发人员工具中查看的响应具有正确的内容

同样的情况也发生在IE 9和IE 11上

有什么办法可以解决这个问题或解决更多问题吗


谢谢。

我记得它应该在“设置”、“隐私设置”中的某个位置。我记得它应该在“设置”、“隐私设置”中的某个位置。