I am stuck as to why we are getting this error now. The code has worked for some time and now we are having issues. Any ideas why we are getting this? I have done research on the web and most people say that you need to set the BufferOutput of the response to true. I have tried this an it does not fix the issue.
Possible problem code:
workbook.SaveAs(Replace(title, " ", ""), ExcelSaveType.SaveAsXLS, response, ExcelDownloadType.PromptDialog)
ExceptionMessage: Server cannot set content type after HTTP headers have been sent.
StackTrace:
at System.Web.HttpResponse.set_ContentType(String value)
at System.Web.HttpResponseInternalWrapper.set_ContentType(String value)
at System.Web.UI.PageRequestManager.RenderPageCallback(HtmlTextWriter writer, Control pageControl)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
at System.Web.UI.Page.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)