Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 改为在浏览器窗口中显示*doc、*xls、*pdf_C#_Asp.net_.doc - Fatal编程技术网

C# 改为在浏览器窗口中显示*doc、*xls、*pdf

C# 改为在浏览器窗口中显示*doc、*xls、*pdf,c#,asp.net,.doc,C#,Asp.net,.doc,我想在浏览器窗口中显示*doc、*xls、*pdf,而不是它们的应用程序。我尝试了以下代码,但没有成功,它提示我保存/打开对话框,而不是在浏览器中显示 //Set the appropriate ContentType. Response.ContentType = "Application/msword"; //Get the physical path to the file. string FilePath = MapPath("wordfile.doc")

我想在浏览器窗口中显示*doc、*xls、*pdf,而不是它们的应用程序。我尝试了以下代码,但没有成功,它提示我保存/打开对话框,而不是在浏览器中显示

    //Set the appropriate ContentType.
    Response.ContentType = "Application/msword";
    //Get the physical path to the file.
    string FilePath = MapPath("wordfile.doc");
    //Write the file directly to the HTTP content output stream.
    Response.AppendHeader("Content-Disposition", "inline;filename=" + "wordfile.doc");
    Response.WriteFile(FilePath);
    Response.End();
请帮忙

感谢

为IE提供浏览器插件/扩展或ActiveX所需的任何这些专有格式
我不确定它是否适用于office格式。

对于PDF,将
内容类型设置为“application/PDF”
内容处置设置为inline
应该可以工作。

如果浏览器不支持此功能,则无法执行此操作。这有点像问“为什么我不能在绘画中打开文档?”。。。