EPPlus error with ajax request

Jun 30, 2015 at 10:52 AM
I cannot seem to get the download to work - I keep getting garbage.  Here is my code:
public void DumpExcel(DataTable dt, string fileName)
            using (ExcelPackage pck = new ExcelPackage())
                ExcelWorksheet ws = pck.Workbook.Worksheets.Add(fileName);
                ws.Cells["A1"].LoadFromDataTable(dt, true);
                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                Byte[] bytes = pck.GetAsByteArray();
                Response.AddHeader("content-disposition","attachment;filename=" + fileName + ".xlsx");
But I get illegal characters in the response. I want to show a screen shot of the result but cannot insert a picture here. Please help!
Jun 30, 2015 at 11:05 AM
You could always upload the screenshot to http://imgur.com/ and linking it here.

Jun 30, 2015 at 12:47 PM
Jul 1, 2015 at 7:48 AM
You're requesting it via AJAX?

Try doing it via a normal form post or redirect...
It looks like AJAX is writing the byte[] down to text...