我把一个word或execl文件写入 response流中.输出.这样的话在客户机浏览器会提示 打开,保存,取消.
怎么样写,可以直接在浏览上把word或execl打开显示出来?

解决方案 »

  1.   

    Response.AddHeader("Content-Disposition", "attachment; filename=" + sTmpFileName);
    下载
    Response.AddHeader("Content-Disposition", "inline; filename=" + sTmpFileName);
    直接打开
      

  2.   

    FileStream fs = new FileStream(docFile.FileView, FileMode.Open);
                    Response.Clear();
                    byte[] bt = new byte[fs.Length - 1];
                    fs.Read(bt, 0, int.Parse(fs.Length.ToString()) - 1);
                    Response.OutputStream.Write(bt, 0, int.Parse(fs.Length.ToString()) - 1);
                    Response.ContentType = "application/octet-stream";
                    Response.AddHeader("Content-Disposition", "inline; filename=" + docFile.FileName + "." + docFile.FileTypeName);
                    Response.End();
                    fs.Close();
                    fs.Dispose();---------
    瞧下我写错没
      

  3.   

    这应该是取决于客户端IE的设置,如果第一次弹出来,上面不是有什么以后就以相同的方式操作的CheckBox吗?
      

  4.   

    安装了 world的话 会直接在IE出来吧?