string fileName = @"C:\Users\ITCA\Desktop\新建Excel.xlsx";
Response.Clear();

Response.ContentType = "application/excel";


FileInfo file = new FileInfo(fileName);

string name=HttpUtility .UrlEncode ("新建Excel");


Response.AddHeader("Content-Disposition", "attachment; filename="+name+".xlsx" );
Response.AddHeader("Content-Length", file.Length.ToString());


Response.WriteFile(fileName);
Response.End();

  设置响应报文 

   contentType

       报头

Response.AddHeader("Content-Disposition", "attachment; filename="+name+".xlsx" );            

显示文件大小  可以看到下载进度s

  Response.AddHeader("Content-Length", file.Length.ToString());

相关文章:

  • 2021-08-16
  • 2021-11-19
  • 2022-01-13
  • 2022-12-23
  • 2021-10-08
  • 2021-11-05
  • 2021-11-13
  • 2022-12-23
猜你喜欢
  • 2022-01-23
  • 2022-12-23
  • 2021-10-08
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案