I have a .net service running on the local machine (Windows 7 x64, IE8, .net 3.5, C#) that returns a file to the browser in response to a user action. Using firefox or chrome, the file is downloaded properly and our application is launched via a custom mime type and all is well.
However, with IE8, I receive a dialog “unable to download file from . Unable to open this internet site. The requested site is either unavailable or cannot be found. Try again later”.
Using fiddler, I verified that IE does receive the payload from the service.
If I turn off UAC, IE does download the file and launch the associated application.
Turning off UAC is not a viable solution, as our customers will have it enabled.
How can I get IE8 to launch the associated application with UAC enabled?
EDIT:
After reregistering the mime type with a programmatic id as described here, I can get IE to open show the “Open or Save” dialog for the SECOND time the link is requested from the address bar. Why doesn’t it work the first time?
I was able to solve this issue today. It turns out that the codebehind was setting the
CacheControlproperty of the response toHttpCacheability.NoCache. Removing that line of code solved the issue. The other half of the fix was correctly registering the mime type and file extension with a ProgId.I stripped down the response to just
content-disposition: attachment; filename=xxxand a binary write of the string data. IE correctly displayed the Open or Save dialog box, even though the mime sniff reported the file as text/html (which really should have been text/plain).I added back the content type header and retested, then the nosniff option and retested and finally the cache control. In between each test, I rebooted the VM to ensure it was a pristine testing environment (ie, nothing cached or preloaded). Only the cache control line affected the behavior in a negative fashion.