Question about SSL and HTTP Compression issues


#1

Laurence, the following code has been working fine on our development machines using MS Server 2003 / IIS 6.0, without HTTP compression and without SSL. Is there anything extra that I need to do to ensure that this code does not break for SSL and/or HTTP compression?

Use case: The server sends an Excel file to an IE client and the client machine displays a Microsoft Open/Save dialog.

I am grateful for you response, since although this helps us to use Aspose.Cells better, it is not strictly speaking an Aspose question. So, thanks very much for your feedback.

// Pseudo-code:

Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + myFileName);
Response.AppendHeader("Content-Length", myFileSize.ToString());

byte[] fileData = // read 1024 bytes
while (fileData.Length > 0)
{
Response.BinaryWrite(fileData);
fileData = // read another 1024 bytes
}

Response.Flush();
Response.SuppressContent = true;

// close binary reader

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.End();


#2

For SSL, I think this piece of code is enough. For http compression, you may have to add following piece of code:

HttpCachePolicy cache = response.Cache;
cache.SetExpires(DateTime.Now - TimeSpan.FromMinutes(1));
cache.SetCacheability(HttpCacheability.Private);

response.AddHeader("pragma","no-cache");