我有一个看起来像这样的方法:
public FileContentResult DownloadFile()
{
// Lots of code
fileData = myWebService.GetFileBytes();
return File(fileData, "application/zip", "myZippedFile.zip");
}
此方法在 Firefox、Chrome 和 Internet Explorer < 11 中运行良好,其中没有任何反应。经过一段时间的谷歌搜索后,我无法找到与我的问题相关的任何内容,所以现在我求助于你。
有没有人遇到过这个问题并找到了解决方案?
编辑 我最近开始深入研究代码并实际查看了调用此方法的 JavaScript,如下所示:
window.navigator.msSaveBlob(blob, filename);
IE11 不调用此行,因为我的浏览器检查无法识别这实际上是 Internet Explorer,因此开始执行仅适用于 Firefox 和 Chrome 的代码。