I have an aspx page with linkbuttons that run javascript to open a new aspx page to stream files to a browser for users to download.
When developing and unit testing on XP SP3, IE 7, and FireFox 3.5, using the following code (the key is part of the "attachment" in the Content-Disposition tag), both ask for a dialog box asking if I want to save or open the document, and thatβs it I want:
private void WriteFileToBrowser(Byte[] requestFile, string filename, String m_mimeType, String m_format) { Response.Clear(); Response.AddHeader("Content-Disposition", "attachment;filename=" + filename + "." + m_format); Response.ContentType = m_mimeType; Response.BinaryWrite(requestFile); Response.Flush(); }
When I deploy this to a Windows 2003 server and go to the same aspx page, FireFox 3.5 sets the Save / Open parameter correctly, as expected, since this is the default operation in FF.
When I move to IE 7, but also load, I get a popup that is visible for the 1 / 8th second vertices ... and disappears. There is no hint to save / open.
If I go to IE 7 -> Tools -> Internet Options -> Security -> User Level -> Downloads
Automatic file download request is disabled. When I check it to enable i, you will get the Save / Open prompt correctly executed.
So my question is ... did anyone come up with a job for this? I tried a bunch of things that people require working with different header tags, such as cache, pragma, etc. Etc .... none of this is due to the fact that IE turned off the download property by default.
Boom shaka laka
source share