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);
        }

相关文章:

  • 2021-08-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-22
  • 2021-11-21
  • 2021-07-03
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案