Hi,
For the last couple of releases of a product we're developing we've been
running to very wierd behavior from IE and our ASP.NET web application which
serves up various types of files and I'm getting very frustrated in trying
to solve it!
We content we are serving up is potentially sensitive and therefore we DO
NOT want it cached on the remote client (IE) beyond the lifetime of the
application rendering it (IE, Powerpoint, Word etc.). Clearly the user can
mess this up but thats another issue.
So on the request for a file we set:
Response.Cache.SetCacheability(HttpCacheability.No Cache);
- or -
Response.Cache.SetNoStore();
Response.Cache.SetNoServerCaching();
The rest of the headers get set pretty much as you'd expect:
Response.StatusCode=200;
Response.ContentType = fileContentType;
Response.AppendHeader("Content-Length", fileContentLength.ToString());
I've tried as many various on caching options and headers as I can think of
and I can't avoid the following behavior:
For certain types of file, like PowerPoint or Word, clicking on a file href
causes:
* IE prompt for a "what do you want to do with this file?". It has the right
type displayed and name.
* Pressing either of these options then results in a Microsoft Powerpoint
dialog saying "Could not open <fullurl>"
* Clicking ok to that dialog causes IE to display an error "could not
download <whatever.ppt> from <somehost>".
* Looking at the web logs IE does NOT execute any further calls to our
application. The only call we see is the single request for the file which
is returned.
For other types of file, like Jpegs, clicking on the href opens the file
within IE and displays the image correctly.
Right-clicking on the href and selecting "Save as" works.
Setting a context-disposition header doesn't make any difference to the
problem above. Removing the "no-cache" header and letting the private cache
expire after 0 minutes works in all cases above - but the file remains in
the machines cache - something we'd like to avoid.
One hypothesis is that IE first downloads the file to a temporary file,
deletes it (no cache), the asks the user what they want to do with it -
which of course fails (or deletes it after the user chooses before
powerpoint sees it or it can be saved).
What am I missing? Is there any way to set "no-cache" for powerpoint and
succeed in opening it once the IE "save/open" dialog appears?
Thanks
Jonathan