通过push下载文件

doc文件

FileInfo fileInfo = new FileInfo(filePath);
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AddHeader("Content-Disposition", "attachment;filename=" + retuFileName);
Response.AddHeader("Content-Length", fileInfo.Length.ToString());
Response.AddHeader("Content-Transfer-Encoding", "binary");
Response.ContentType = "application/octet-stream";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
Response.WriteFile(fileInfo.FullName);
Response.Flush();
Response.End();

zip文件

Response.Clear();
Response.ClearContent();
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename=" + fileZip);

Response.TransmitFile(dirZipPath);
Response.Flush();
Response.Close();

相关文章:

  • 2022-02-15
  • 2022-12-23
  • 2022-02-15
  • 2021-07-15
  • 2021-10-19
  • 2021-10-31
  • 2022-01-13
  • 2021-05-28
猜你喜欢
  • 2021-07-11
  • 2021-10-24
  • 2022-02-04
  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
  • 2022-01-31
相关资源
相似解决方案