Search code examples
javascripthtmlasp.netiisodt

ASP window.open file ODT


I have some problems with a function window.open('url'). My variable "url" focus on a ODT file and when i try to open this file with a web browser (http://localhost//../test.odt), I have "HTTP 404 PAGE NOT FOUND".

I have already tried with diferent extentions : png, pdf, docx, etc. and it's work.

For information : the file is uploaded on a local repertory.Is the problem could be the MIME content or something else ?

Thanks you


Solution

  • Your website in IIS don't have configured MIME type for .odt files. Correct mimetype is:

    application/vnd.oasis.opendocument.text 
    

    In your web.config file you need to add inside system.webServer section:

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