【发布时间】:2015-10-12 12:07:07
【问题描述】:
我在文件系统中有.zip 文件。我想下载那个文件。到目前为止,我已经完成了
HttpContext.Current.Response.ContentType = "application/zip";
HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=" + FileName);
HttpContext.Current.Response.TransmitFile(zipName);
HttpContext.Current.Response.End();
但它直接打开文件而不是保存它。保存的话怎么下载呢?
我也见过DownloadFile(String, String),但我的第一个论点是什么?
【问题讨论】:
-
你可以得到
some help here -
@fubo 不,它不重复。因为我的浏览器下载的是 excel 文件而不是 zip。所以我猜浏览器设置没问题
-
尝试将
<mimeMap fileExtension=".zip" mimeType="application/zip" />添加到网络配置> syste.webserver > staticcontent