ASP window.open 文件 ODT

ASP window.open file ODT

我的函数 window.open('url') 有一些问题。 我的变量 "url" 关注一个 ODT 文件,当我尝试使用网络浏览器 (http://localhost//../test.odt) 打开该文件时,我有 "HTTP 404 PAGE NOT FOUND".

我已经尝试过不同的扩展:png、pdf、docx 等,它的工作。

参考:文件上传到本地repertory.Is问题可能是 MIME 内容或其他问题?

谢谢你

您在 IIS 中的网站没有为 .odt 文件配置 MIME 类型。正确的 mimetype 是:

application/vnd.oasis.opendocument.text 

在您的 web.config 文件中,您需要在 system.webServer 部分中添加:

<staticContent>
    <remove fileExtension=".odt" />
    <mimeMap fileExtension=".odt" mimeType="application/vnd.oasis.opendocument.text" />
</staticContent>