Tech
Forums
Jobs
Books
Events
Videos
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
1
Answer
Server can't append header after HTTP headers have been send
Ankit Agarwal
9y
2.4k
1
Reply
Hello,
How to resolve this error "Server cannot append header after HTTP headers have been sent".
When i run second function for download excel, its getting error.
public void ExportQRCodeGenerateImageTableData(string data)
{
string attach = "attachment;filename=QRGenerateImage.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attach);
Response.ContentType = "application/ms-excel";
Response.Write(data);
Response.Flush();
//Response.End();
}
public void ExportAllCustomerTableData(string data)
{
string attach = "attachment;filename=CustomerDetails.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attach);
// Error:Server cannot append header after HTTP headers have been sent.
Response.ContentType = "application/ms-excel";
Response.Write(data);
//Response.End();
Response.Flush();
}
Please help me.
Thanks in Advance
Ankit Agarwal
Software Engineer
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
How do I lockand unlock a table in sql server 2008
What is ViewData in MVC