I've written code to generate an excel spreadsheet. I generate the spreadsheet with the following VB.NET code:
Workbook.SaveAs(sDisplayFileName, ExcelSaveType.SaveAsXLS, response, ExcelDownloadType.Open)
It works fine with HTTP but IE 6 and 7 can't open or save the resulting file when using HTTPS. I've opened a case with Microsoft support and they've told me that in order for the browser to get the Excel file using HTTPS, cache-control has to be ON. But when we look at the response header in Fiddler, we see that cache-control is set to "no-cache". We've enabled caching on IIS, yet the response header is still indicating "no cache". Since my code isn't setting that header property, it seems likely that the XLSio library might be doing this.
Is there any way to enable caching thru the XLSio library?
Here is the response header:
HTTP/1.1 200 OK
Date: Thu, 22 Jul 2010 19:19:18 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Pragma: no-cache
Pragma: public
Content-Disposition: inline; filename=Skills_Software_UT500_20100722-1519.xls;
Transfer-Encoding: chunked
Cache-Control: no-cache, no-store
Pragma: no-cache
Expires: -1
Content-Type: Application/x-msexcel
thanks,
bert
GM
Geetha M
Syncfusion Team
July 23, 2010 06:41 AM UTC
Hi Bert,
Thank you for your interest in Syncfusion products.
Currently it is not possible to control cache used in XlsIO library. However, you can save the workbook as stream and then send the file using HttpResponse where you can handle the cache on your own.
MemoryStream ms = new MemoryStream();
workbook.SaveAs(ms);
byte[] byteBuffer = new byte[ms.Length];
byteBuffer = ms.GetBuffer();
Response.ClearHeaders();
Response.Clear();
//Response.CacheControl =
Response.ContentType = "Application/ms-excel";
Response.AppendHeader("Content-Disposition", "inline; filename=\"Sample.xls\"");
Response.BinaryWrite(byteBuffer);
Response.Flush();
Response.End();
ms.Dispose();
workbook.Close();
excelEngine.Dispose();
Please try this and let us know if you have any questions.
Regards,
Geetha
BS
Bert Sirkin
July 23, 2010 11:45 AM UTC
Thanks Geetha - that allowed me to set the caching and it now works with HTTPS.
bert
GM
Geetha M
Syncfusion Team
July 26, 2010 05:04 AM UTC
Hi Bert,
Thanks for the update.
Regards,
Geetha