[mapguide-users] Forcing MgByteReader download prompt in IE7
(asp.net)
Jackie Ng
jackie.ng at aecsystems.com.au
Mon Oct 22 05:41:09 EDT 2007
Some extra info/discoveries.
I basically have a "Plot DWF" invoke script command on the AJAX viewer
toolbar, which basically opens my DWF Plot script (which contains the code I
posted) in a new window.
But for some reason or another, Internet Explorer 7 "ignores" the
content-disposition header when opened in a new window. Whereas Firefox/IE 6
correctly display the download prompt.
So my current workaround is currently a very ugly hack of putting a browser
check in the invoke script command, and if it was ie7, to post that script
to the formframe (where it actually works!), otherwise to open that script
in a new window.
Ugh, why must microsoft make my life so difficult??? >:-(
- Jackie
Jackie Ng wrote:
>
> I'm trying to write out the contents of an MgByteReader (which is from a
> dwf plot) so that the user is prompted to download the MgByteReader
> content as a file. I can get this to work perfectly in Firefox/IE6, but
> for some reason in IE7 doesn't prompt me to download, and I get nothing in
> the browser window.
>
> Here's the code in question, byteReader is the MgByteReader containing a
> dwf plot.
>
> ----------------------------------------------------
> using (MemoryStream stream = new MemoryStream())
> {
> byte[] buffer = new byte[1024];
> int bytes = byteReader.Read(buffer, 1024);
>
> while (bytes > 0)
> {
> stream.Write(buffer, 0, bytes);
> bytes = byteReader.Read(buffer, 1024);
> }
>
> Response.ContentType = byteReader.GetMimeType();
> byte[] content = stream.ToArray();
>
> Response.AppendHeader("content-disposition", "attachement;
> filename=\"eplot.dwf\"");
> Response.OutputStream.Write(content, 0, content.Length);
> }
> -------------------------------------------------------
>
> Does anyone know how I can get IE7 to cooperate with me? >:-(
>
> - Jackie
>
--
View this message in context: http://www.nabble.com/Forcing-MgByteReader-download-prompt-in-IE7-%28asp.net%29-tf4668855s16610.html#a13339678
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list