I'm working on a website (MVC4) that can generate PowerPoint files (pptx). I've confirmed that the files open OK by opening them on the server, and by copying them from the server to my local computer and opening them. They can be downloaded from the site by browsing to an action that returns a FileContentResult:
return new FileContentResult(powerpointBytes, "application/vnd.openxmlformats-officedocument.presentationml.presentation") { FileDownloadName = fileName + ".pptx" };
On the server, the download is OK in Firefox, but in Chrome or Safari, the file is corrupted and I'm asked if I want to try and repair it, which doesn't work.
Locally I can download the file in Firefox, Chrome and Safari and it opens fine.
The only thing I could think of doing is checking the MIME type in IIS for pptx, and it's set to this locally and on the server:
application/vnd.openxmlformats-officedocument.presentationml.presentation
(What is a correct mime type for docx, pptx etc?)
Does anyone have any ideas on what could be causing this?