While downloading excel file in IE browser getting an error "The connection with server was reset"
Hello,
I am exporting the excel file by passing the datatable.
I am using Handler file in asp.net.
All browser it is working fine but only in IE getting an error.
"The connection withe the server was reset"
I am using the EEPlus libreary i.e :using OfficeOpenXml;
I have some code like:
context.Response.ClearContent();
context.Response.Buffer = true;
context.Response.Charset = "";
context.Response.ClearHeaders();
using (ExcelPackage excelPackage = new ExcelPackage())
{
ExcelWorksheet wsExportOrder = excelPackage.Workbook.Worksheets.Add("Export Orders");
//Load the dtExportOrders data table into the sheet.
wsExportOrder.Cells.LoadFromDataTable(dtExportOrders, true);
string fileName = @"Export Orders.xls";
//Write it back to the client
context.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
context.Response.AddHeader("content-disposition", "attachment; filename=\"" + fileName + "\"");
context.Response.BinaryWrite(excelPackage.GetAsByteArray());
context.Response.Flush();
}
context.Response.End();