如题
有关IE中直接打开word、excel、pdf等文档(是直接打开不需要下载提示,也不需要客户端修改IE安全设置)

解决方案 »

  1.   

    直接打开.doc的url,或者设置Response.ContentType为word/application,然后再输出word内容excel/pdf也一样
      

  2.   


            FileInfo DownloadFile = new FileInfo("D:\\Distance Education\\Distance Education System\\WebSystem_V1.0\\Images\\UpLoad\\2009-03\\Courseware\\123.doc");
            this.Response.Clear();
            this.Response.ClearHeaders();
            this.Response.Buffer = true;
            this.Response.ContentType = "word/application";
            this.Response.AppendHeader("Content-Language", "zh");
            this.Response.AppendHeader("Content-Disposition", "inline;filename=" + Server.UrlEncode("123.doc"));
            this.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            this.Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
            this.Response.WriteFile(DownloadFile.FullName);
            this.Response.Flush();
            this.Response.End();这是我以前写的代码,出来的是乱码
      

  3.   

    http://www.soidc.net/discuss/1/050119/09/313173_1.html
      

  4.   

    关注~好象需要浏览方有word才能在线预览的!!
      

  5.   

    加上这句话
    this.Response.AppendHeader("Content-Disposition", "inline;filename=123.doc");
    就没有下载提示的
    一定要inline
    如果一定要下载提示就改成“attachment;filename=123.doc
    就可以了
      

  6.   


    我很晕啊   帮不了你了  我加上这句话还是出现一个对话框  让我选择下载还是打开this.Response.ContentType = "word/application";跟
    this.Response.ContentType = "application/msword";没有有区别吧
      

  7.   

    jie3614 
    我这里也是有提示了晕死不知道什么原因
      

  8.   

    和服务器有关?需要修改mime type?