Show ZIP file using IE

  • Thread starter Thread starter Just D.
  • Start date Start date
J

Just D.

All,

I know that we can easily expose RTF file and IE will open an appropriate
application for this file. Here is the code:

Response.Clear();
Response.Charset = "";
Response.ContentType = "application/msword";
Response.Buffer = true;
Response.Write(SomeRTFReport);

How can we do similar to show ZIP archive loaded on the server side as
byte[]? When I try to do that using this trick:

Response.Clear();
Response.Charset = "";
Response.ContentType = "application/zip";
Response.Buffer = true;
Response.Write(SomeZippedReports);

It doesn't work this way. Did anybody do that and how? I don't want to use
temp files and keep these bin ZIP files on the server side to let user
download it, but I'd like to find a way to write the content of this file
directly into the stream to let IE load it and start the app associated with
ZIP archives.

Just D.
 
All,
I know that we can easily expose RTF file and IE will open an appropriate
application for this file. Here is the code:

Response.Clear();
Response.Charset = "";
Response.ContentType = "application/msword";
Response.Buffer = true;
Response.Write(SomeRTFReport);

How can we do similar to show ZIP archive loaded on the server side as
byte[]? When I try to do that using this trick:

Response.Clear();
Response.Charset = "";
Response.ContentType = "application/zip";
Response.Buffer = true;
Response.Write(SomeZippedReports);

It doesn't work this way. Did anybody do that and how? I don't want to use
temp files and keep these bin ZIP files on the server side to let user
download it, but I'd like to find a way to write the content of this file
directly into the stream to let IE load it and start the app associated with
ZIP archives.

Just D.

The content type is OK, you might want to use Response.BinaryWrite(..)
and maybe Response.AppendHeader("Content-Disposition",
"attachment;filename=thefile.zip");

Hans Kesting
 
Back
Top