Import large number of records to Excel not working in .NET

Hi Team,
For export to Excel, I am connecting to DB which is taking approx 3 mins of time to fetch the data. Then I am exporting to Excel. In local it is getting exported. But in server if I will click Open from open/save dialogue box, it is giving me the error like “the excel couldn’t be downloaded” with retry option.

Could you please check.

Thanks,
Rosalini

@rosalini,

Thanks for your query.

The issue might not be related to Aspose.Cells APIs as it is already working in your local env as you mentioned. Do you use IE browser type? I guess, you should install latest security updates for IE on the server.

I think you are referring to Workbook.Save() overload method which contains Response and Content Disposition options in your web project. Well, it might be due to your IE browser type issue and nothing to do with Aspose.Cells, as actually when the Download dialog box is displayed, the browser takes the charge.

You may confirm the issue by using the following sample code even without involving Aspose.Cells APIs. For example, you can manually create the sample XLSX file into MS Excel, then use your own code streaming the file without involving Aspose.Cells APIs and response to the browser to check if it works fine or you got the similar problem.
e.g.

Sample code:

FileStream fs1 = new FileStream("d:\\Book1.xlsx", FileMode.Open, FileAccess.Read);
byte[] data1 = new byte[fs1.Length];
fs1.Read(data1, 0, data1.Length);
this.Response.ContentType = "application/xlsx";
Response.AddHeader( "content-disposition","attachment; filename=outParameterList.xlsx");
Response.BinaryWrite(data1);
Response.End();