I have code on an aspx page, then when users load the page , it starts zip loading. Looks like that:
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileSaveName);
Response.TransmitFile(zipPath);
Response.End();
The problem is that the first time this happens. I get the following error:

The mail file exists and is not in my wwwroot. If I refresh the page, the file will load normally.
If I complete the code in Try Catch, I get a System.Threading.Threadabort exception with the message:
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
NOTE. I get this exception every time. I assume this is easy to do with Response.End
Thanks for any help!
source
share