We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

XLSIO / asp.net Error with HTTPS

Thread ID:

Created:

Updated:

Platform:

Replies:

95658 Jul 22,2010 07:48 PM UTC Jul 26,2010 05:04 AM UTC ASP.NET Web Forms (Classic) 3
loading
Tags: XlsIO
Bert Sirkin
Asked On July 22, 2010 07:48 PM UTC

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



Geetha M [Syncfusion]
Replied On 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

Bert Sirkin
Replied On July 23, 2010 11:45 AM UTC

Thanks Geetha - that allowed me to set the caching and it now works with HTTPS.

bert

Geetha M [Syncfusion]
Replied On July 26, 2010 05:04 AM UTC

Hi Bert,

Thanks for the update.

Regards,
Geetha

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;