protected void LinkButton1_Click(object sender, EventArgs e)
    {
        if (Session["txt"] != null)
        {
           
                string fileName = "";//客户端保存的文件名
                string filePath = Server.MapPath("./") + fileName;//路径                FileInfo fileInfo = new FileInfo(filePath);
          if (fileInfo.Exists)
            {
                Response.Clear();
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
                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();
            }
        }
        else
        {
            Page.RegisterStartupScript("sb", "<script>alert('请先选择文件名')</script>");
        }     }
代码如上,必须将红色代码改成如下形式,
string filePath = Server.MapPath("申请书.doc");
才能下载下来,而其他格式的文件则下载不下来  或者下载下来是不能打开。
问题是怎么修改可以下载任何格式,而不是只下载一个格式或一个文件,
文件的下载过程中用了 ListBox控件。