views:

1120

answers:

1

We have a web application that displays a variety of document types to the user. When a user tries to view a docx file, they get a dialog box asking them if they want to save the file "DisplayDocument.aspx" if they are using Office 2003.

I can reproduce this behavior and I've tried installing the Word Viewer and the File Type converter (in both orders). I've checked and that file type is associated with Word on my local box and the docx MIME type is loaded on the server.

The current solutions seem to be to resubmit the document as a pdf or upgrade Office. Neither of which are convenient for the users.

I am imagining that part of the problem is that our security policy does not allow any files to be opened in the browser and that they have to be downloaded to the users local machine before they are opened so the virus protection can scan them, but I can't see why it would be affecting the docx and not the doc files.

Note: If the user has Office 2007 this is not an issue.

Any help is appreciated. Thanks.

A: 

You can use a HTTP Header to force it to download instead of attempting to open the file. That way, when it asks to save it, the file has the correct content type and can be saved as a docx file. See http://msdn.microsoft.com/en-us/library/ms524327.aspx

I would add the following headers:

Content-type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Content-disposition: attachment; filename=Filename.docx
Mitch