private void FileDownload(string FullFileName)
{
 FileInfo DownloadFile=new FileInfo(FullFileName);
 Response.Clear();
 Response.ClearHeaders();
 Response.Buffer=false;
 Response.ContentType="application/octet-stream";
 Response.AppendHeader("Content-Disposition","attachment;filename="
  +HttpUtility.UrlEncode(DownloadFile.FullName,System.Text.Encoding.UTF8));
//上面用了URL编码,否则中文的文件名会显示乱码
 Response.AppendHeader("Content-Length",DownloadFile.Length.ToString());
 Response.WriteFile(DownloadFIle.FullName);
 Response.Flush();
 Response.End();
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2021-10-31
  • 2021-08-15
  • 2021-11-22
  • 2021-12-06
猜你喜欢
  • 2021-10-10
  • 2021-05-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案