B
brian
I have a aspx page that creates a binary file and response.binarywrites
it to the browser. To force the file to be saved or opened I use the
"Content-Disposition" header.
All works fine in Firefox but I have some strange issues with IE where
I get the error:
"Internet Explorer was not able to open the Internet Site"
from the "file download" dialog box, but before Im given the choice to
open or download.
The strange bit is that exactly the same code works fine with IE
locally, but not once I put it live
(http://www.earthware.co.uk/ukcinemas/default.aspx).
Also if I type the URL directly into IE it never works, but it I follow
a normal <a href> in an html page to the url it works fine
(http://www.earthware.co.uk/ukcinemas/test.html)?
Ive played with lots of suggestions with caching as you can see from
the commented out sections in the code below but none seem to work.
Any ideas?
Code:
Response.AddHeader("Content-Disposition", "attachment;
filename=uk-cinema-listings.kmz");
//Response.AddHeader("Cache-Control", "no-store, no-cache,
no-transform, must-revalidate, private");
//Response.Cache.AppendCacheExtension("no-cache");
//Response.AddHeader("Expires", "0");
Response.AddHeader("pragma", "no-cache");
Response.ExpiresAbsolute = new DateTime(1900,1,1);
byte[] kmz = geUtils.Document.ToKmz();
Response.AddHeader("Content-Length", kmz.Length.ToString());
Response.ContentType = "application/vnd.google-earth.kmz+xml;";
Response.Charset = "utf8";
//Response.Flush();
Response.BinaryWrite(kmz);
Response.End();
Brian
it to the browser. To force the file to be saved or opened I use the
"Content-Disposition" header.
All works fine in Firefox but I have some strange issues with IE where
I get the error:
"Internet Explorer was not able to open the Internet Site"
from the "file download" dialog box, but before Im given the choice to
open or download.
The strange bit is that exactly the same code works fine with IE
locally, but not once I put it live
(http://www.earthware.co.uk/ukcinemas/default.aspx).
Also if I type the URL directly into IE it never works, but it I follow
a normal <a href> in an html page to the url it works fine
(http://www.earthware.co.uk/ukcinemas/test.html)?
Ive played with lots of suggestions with caching as you can see from
the commented out sections in the code below but none seem to work.
Any ideas?
Code:
Response.AddHeader("Content-Disposition", "attachment;
filename=uk-cinema-listings.kmz");
//Response.AddHeader("Cache-Control", "no-store, no-cache,
no-transform, must-revalidate, private");
//Response.Cache.AppendCacheExtension("no-cache");
//Response.AddHeader("Expires", "0");
Response.AddHeader("pragma", "no-cache");
Response.ExpiresAbsolute = new DateTime(1900,1,1);
byte[] kmz = geUtils.Document.ToKmz();
Response.AddHeader("Content-Length", kmz.Length.ToString());
Response.ContentType = "application/vnd.google-earth.kmz+xml;";
Response.Charset = "utf8";
//Response.Flush();
Response.BinaryWrite(kmz);
Response.End();
Brian