string filepath = Server.MapPath("~/public/file.txt"); 
        FileInfo fi = new FileInfo(filepath);
        Response.Clear();
        Response.AddHeader("Content-Disposition", "attachment; filename=" + fi.Name);
        Response.AddHeader("Content-Length", fi.Length.ToString());
        Response.ContentType = "application/octet-stream";
        Response.Filter.Close();
        Response.WriteFile(fi.FullName);
        Response.End();

相关文章:

  • 2022-12-23
  • 2022-02-03
  • 2021-11-18
  • 2021-11-18
  • 2021-06-13
  • 2022-02-12
猜你喜欢
  • 2021-08-18
  • 2021-05-21
  • 2021-07-07
  • 2022-01-17
相关资源
相似解决方案