This code is in control.ascx and control is put in ModalPopup.aspx page.
First ai try with response.end() – this code throw exception.
After ai try coment this line, but nothing is hapen.
Browser is IE8
try
{
//export
StringBuilder sb = ExportToExcelXml();
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
byte[] byteText = encoding.GetBytes(sb.ToString());
Response.Clear();
Response.Charset = "utf-8";
Response.ContentType = "text/xls";
Response.AddHeader("content-disposition", "attachment; filename=export.xls");
Response.BinaryWrite(byteText);
//Response.End();
}
catch (Exception ex)
{
Once the response has been started, you cannot clear it and change it’s content type. In the case of an .ascx file, you’re inside an .aspx file which is probably already started filling out the response. Can you move this to a .ashx (Generic Handler) instead?