Response.AppendHeader("Content-Disposition","attachment; filename="+HttpUtility.UrlEncode(strFileName,System.Text.Encoding.UTF8));
Response.WriteFile(filePath);
Response.End();

解决方案 »

  1.   

    string path=this.GetFilePath();           //获得文件路径
    FileInfo fInfo=new FileInfo(path);
    string fname=fInfo.Name;
    Response.Clear();
    Response.AddHeader("Content-Disposition","attachment;filename="+HttpUtility.UrlEncode(fname));
    Response.AddHeader("Content-Length",fInfo.Length.ToString());
    Response.ContentType="application/octet-stream";
    Response.WriteFile(fInfo.FullName);
    Response.Flush();
    Response.End();
      

  2.   

    Response.Flush();   
            Response.AppendHeader("Content-Disposition", "");
            Response.AppendHeader("Content-Length", "0");这里明显错误。  
    都开始让用户下载了,如何再修改http头呀