I get the above error in my asp.net webforms application when using httpcontext to download a zip file. the code that handles the download works perfect when deployed to production server, but only on my machine that is where i get the error. any ideas what causes this ?Thanx.
Asked
Active
Viewed 2,080 times
0
-
Well you're probably doing something locally you don't do on your production server, like a response.write or something like this. once you used response.write or anything else sending a response to the user, you can't modify headers... – Laurent S. Nov 19 '13 at 13:48
-
I dont change anything on producton server, this is the code i use: Response.Clear(); Response.AppendHeader("Content-Disposition", "attachment; filename=" + zipFilename); Response.ContentType = "application/x-zip-compressed"; Response.WriteFile(ZipFilePath); Response.Flush(); this was working before, and now all of a sudden has stopped working. i use response.flush() because i have a method that needs to be called after the download (ie basically a method that clean a temporary folder) , if i use response.end(), the code doesnt crash, but then it doesn't download either – Andris Mudiayi Nov 20 '13 at 07:53
-
Have you tried to put the `AppendHeader` instruction after changing the content-type ? It looks like the error message points exactly to that... Note that the error could aswell be in the part of the code you don't show. And as a side note, you should put and format your code in your question, not in a comment... – Laurent S. Nov 20 '13 at 09:38