Js:发送请求:
window.location.href = "/Log/DownloadExcel?Excel=" + data;
Controller:
public ActionResult DownloadExcel() { string excel = Request.QueryString["Excel"] ?? ""; //if (excel == "") //{ // return; //} string path = System.Web.HttpContext.Current.Server.MapPath("~/Excel"); string filepath = string.Format("{0}\\{1}", path, excel); string name = Path.GetFileName(filepath); return File(filepath, "application/x-zip-compressed", name); }