Hi,
I am trying to download xlsx file. It works fine if I Response.End. But I replace Response.End with HttpContext.Current.ApplicationInstance.CompleteRequest(), the file gets downloaded but while opening in excel I get popup "Excel found unreadable content..."
Response.ClearHeaders();
Response.AppendHeader("Content-Disposition", "attachment; filename=" + downloadFileName);
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
//Check that the client is connected and has not closed the connection after the request
if (Response.IsClientConnected)
{
Response.BinaryWrite(obj);
}
Response.Flush();
try
{
Response.End();
//Can we call instead of Response.End
//http://support.microsoft.com/kb/312629
//HttpContext.Current.ApplicationInstance.CompleteRequest();
}
catch (Exception ex) ...
Go to the complete details ...