就是下载doc.txt等文件也要象下载zip文件一样ie摊弹出另存为对话框.
我在服务器端必须要用Stream的方式.

解决方案 »

  1.   

    Response.AppendHeader("Content-Disposition", "attachment;filename=" + strDisplayname);请用attachment(用附件方式),如果用inline的话,就会直接在IE里打开了.看看是不是这个问题.如果还不行,给我发消息!
      

  2.   

    down.aspx?path=d:\aa.docstring path = Request.QueryString["path"];
    string fileName = Path.GetFileName(path);
    Response.Clear();
    Response.ContentType = "application/octet-stream";
    //Response.AddHeader("Content","charset=utf-8");
    Response.AddHeader("Content-Disposition", "attachment; filename=" +HttpUtility.UrlEncode(fileName));


    Response.WriteFile(path);
      

  3.   

    我还是有一个疑问。(atlove(星) 请你回答
    我在服务器端把文件以stream的形式读取出来.能直接的用Response推出来马?
      

  4.   

    只要通过脚本更改IE的HEADER,然后用标准输出方式就可以了。主要的是对HEADER的更改,决定了输出时的行为。下面的脚本是基于PHP的,FYI:
    -------------------------------------------------
    header("Content-type: application/download");
    header("Content-Disposition: filename=$name");$fp=fopen($strFullPath,"rb");
    fpassthru($fp);
    flush();
    -------------------------------------------------