我在aspx页面上有一些代码,然后当用户加载页面它开始下载一个zip。看起来是这样的:ASP.NET Response.TransmitFile第一次下载失败
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileSaveName);
Response.TransmitFile(zipPath);
Response.End();
的问题是第一次,这是打我得到以下错误:
的zip文件存在,是不是在我的wwwroot。如果我刷新页面,文件将下载正常。
如果我换行代码在尝试捕捉我得到一个System.Threading.Threadabort异常与消息:
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
注意:每一次我居然拿到例外。我想它只是用来做Response.End
感谢您的任何帮助!
我觉得对话框报告下载GetHands.aspx很奇怪。也许这是一个线索? – 2010-10-19 00:55:39
添加Response.Clear()开头 – hova 2010-12-30 21:06:28