的docx文件犯规浏览器与IE 8的内容配置内嵌开放 [英] docx file doesnt open in browser with content disposition inline in IE 8

查看:203
本文介绍了的docx文件犯规浏览器与IE 8的内容配置内嵌开放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从asp.net在IE中打开的docx文件。在IIS有正确映射MIME类型。我可以打开PDF罚款,但DOCX总是提示我下载喜欢内容处置='附件'。有没有做任何设置?

  Response.Clear();
            Response.ClearContent();
            Response.ClearHeaders();
            Response.Cookies.Clear();
            Response.Cache.SetCacheability(HttpCacheability.Private);
            Response.CacheControl =私人;
            Response.Charset的= System.Text.UTF8Encoding.UTF8.WebName;
            Response.ContentEncoding = System.Text.UTF8Encoding.UTF8;
            Response.AppendHeader(内容长度,buffer.Length.ToString());
            Response.AppendHeader(杂注,高速缓存);
            Response.AppendHeader(过期,60);
            Response.ContentType =应用程序/ vnd.openxmlformats-officedocument.wordpro​​cessingml.document
            Response.AppendHeader(内容处置,
            内联;+
            文件名= \\+test.docx+\\,+
            大小=+ buffer.Length.ToString()+,+
            创建日期=+ DateTime.Now.ToString(R)+;+
            修改的最新=+ DateTime.Now.ToString(R)+,+
            读 - 日期=+ DateTime.Now.ToString(R));
            Response.BinaryWrite(缓冲液);
            Response.Flush();
            HttpContext.Current.ApplicationInstance.CompleteRequest();
            到Response.End();


解决方案

是微软Word或的的Word Viewer 的安装在计算机上的被测试?

如果处理程序不存在,浏览器将没有太多的选择,但下载的文件。

如果安装Word,您可能还需要检查,如果您的Windows文件类型都映射的.docx到Word,到另一个应用程序或不了了之。通过使用此 MSKB文章中说明

检查

I want to open docx file in IE from asp.net. The IIS has mime type correctly mapped. I can open pdf fine but docx will always prompt me to download like content-disposition='attachment'. Is there any setting to be done?

            Response.Clear();
            Response.ClearContent();
            Response.ClearHeaders();
            Response.Cookies.Clear();
            Response.Cache.SetCacheability(HttpCacheability.Private);
            Response.CacheControl = "private";
            Response.Charset = System.Text.UTF8Encoding.UTF8.WebName;
            Response.ContentEncoding = System.Text.UTF8Encoding.UTF8;
            Response.AppendHeader("Content-Length", buffer.Length.ToString());
            Response.AppendHeader("Pragma", "cache");
            Response.AppendHeader("Expires", "60");
            Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
            Response.AppendHeader("Content-Disposition",
            "inline; " +
            "filename=\"" + "test.docx" + "\"; " +
            "size=" + buffer.Length.ToString() + "; " +
            "creation-date=" + DateTime.Now.ToString("R") + "; " +
            "modification-date=" + DateTime.Now.ToString("R") + "; " +
            "read-date=" + DateTime.Now.ToString("R"));
            Response.BinaryWrite(buffer);
            Response.Flush();
            HttpContext.Current.ApplicationInstance.CompleteRequest(); 
            Response.End();

解决方案

Is Microsoft Word or Word Viewer installed on the computer being tested with?

If the handling application is absent, the browser won't have much choice but to download the file.

If Word is installed, you might also want to check if your Windows File Types have .docx mapped to Word, to another app or to nothing. Check by using instructions in this MSKB article

这篇关于的docx文件犯规浏览器与IE 8的内容配置内嵌开放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆