【发布时间】:2013-05-26 14:41:23
【问题描述】:
我的下载只是提供来自本地文件系统的静态 zip 文件,该文件在 Chrome 和 Firefox 中有效,但在 IE8 中无效。
该网站使用 SSL 在 localhost 上运行,但我在 IE 中收到以下错误消息。
无法从 localhost 下载 Download/。
无法打开此 Internet 站点。请求的站点是 不可用或找不到。请稍后再试。
public ActionResult Download(long batchID)
{
var batchFilePath = string.Format(BatchOrderReportsFolder + "\\Batch-{0}\\Batch-{0}.zip", batchID);
if (!System.IO.File.Exists(batchFilePath)) {
return RedirectToAction("Index", "Error");
}
return File(batchFilePath, "application/zip", Path.GetFileName(batchFilePath));
}
【问题讨论】:
-
您是否尝试过
FileResult而不是ActionResult(不确定这是否仅适用于MVC4)? -
我删除了 if 块并将返回类型设置为 FileResult,但我得到了同样的错误。
标签: asp.net-mvc internet-explorer-8 download fileresult