Hi,
I have to export 3 excel file at a time on a button click.
Creating excel code is in FOR LOOP.
First excel is downloaded but then for second excel it is giving error "Server cannot clear headers after HTTP headers have been sent"
Below is my code to export :
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.ClearContent();
response.ClearHeaders();
response.Buffer = true;
response.AppendHeader("Content-Disposition", "attachment;filename=\"" + documentName + "_" + category + "_OrderBook.xlsx" + "\"");
response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
response.WriteFile(path);
response.Flush();
File.Delete(path);
//response.End();
HttpContext.Current.ApplicationInstance.CompleteRequest();
Go to the complete details ...