We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Export to excel in SSL. is throwing error

Hi,

Im trying to export data to excel using aspose through our SSL enabled site. I'm getting the following error "internet explorer cannot download pagename.aspx from abc.com. Internet explorer was not able to open this internet site. The requested site is either unavailable or not found. Please try later".

I'm using following code.

MemoryStream stream = new MemoryStream();<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

workbook.Save(stream, FileFormatType.Default);

response.ContentType = "application/vnd.ms-excel";

response.AddHeader( "content-disposition","attachment; filename=” + Session["ReportType"] + ".xls");

response.BinaryWrite(stream.ToArray());

Any help on this is much appreciated. The same code works if ssl is off


This message was posted using Page2Forum from Aspose.Cells for .NET and Java - Documentation

Hi,

Well, I think this is the issue with IE / browser type. Are you using IE 6.0 version. I think you may try the following steps (opening the Internet Explorer) if it fixes the issue.

  • Click Tools>Internet Options
  • Click the Advanced tab
  • Check the box that says Do not save encrypted pages to disk

I think alternatively, since you pass the spreasheet to the Response object, you might try setting the cachability before writing the streams
e.g..,

Response.Cache.SetCachebility(HttpCache.NoCache);

Thank you.


Thanks for your prompt response. let me try and let you kno.

Hi,

thanks for your response. But the issue still exists.

i used the following piece of code

Response.ClearHeaders();

Response.ClearContent();

Response.Buffer = true;

//workbook.Save(Session["ReportType"] + ".xls", FileFormatType.Default, SaveType.OpenInExcel, Response);

MemoryStream stream = new MemoryStream();

workbook.Save(stream, FileFormatType.Default);

//workbook.Save(Session["ReportType"] + ".xls", FileFormatType.Default, SaveType.OpenInExcel, Response);

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Response.ContentType = "application/vnd.ms-excel";

Response.AddHeader("content-disposition", "attachment; filename= " + Session["ReportType"] + ".xls");

Response.BinaryWrite(stream.ToArray());

Response.Flush();

Hi,

Could you try the following code without using Aspose.Cells APIs if the issue is still there.

FileStream fs1 = new FileStream("d:\\testbook.xls", FileMode.Open, FileAccess.Read);
byte[] data1 = new byte[fs1.Length];
fs1.Read(data1, 0, data1.Length);

this.Response.ContentType = "application/xls";
Response.AddHeader( "content-disposition","inline; filename=book1.xls");
Response.BinaryWrite(data1);
Response.End();


Thank you.