protected void btn_Download_Click(object sender, EventArgs e)
    {
        string strFileUploadPath = "Files/";
        //从列表框控件中读取选择的文件名
        string strFileName = lb_FileList.SelectedValue; //组合成物理路径
        string strFilePhysicalPath = Server.MapPath("~/" + strFileUploadPath + strFileName);
        Response.Clear();
        Response.ContentType = "application/octet-stream";
        Response.AddHeader("Content-Disposition", "attachment;FileName=" + HttpUtility.UrlEncode(strFileName, System.Text.Encoding.UTF8));
        Response.WriteFile(strFilePhysicalPath);
        Response.End();
    }

 

相关文章:

  • 2021-06-03
  • 2021-04-25
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2021-11-17
猜你喜欢
  • 2022-01-09
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2021-08-24
  • 2021-12-01
  • 2021-12-26
相关资源
相似解决方案