C# ASP.Net发送大型附件-在完成之前阻止浏览
我正在IIS上的ASP.Net中运行以下代码:C# ASP.Net发送大型附件-在完成之前阻止浏览,c#,asp.net,exception,iis,download,C#,Asp.net,Exception,Iis,Download,我正在IIS上的ASP.Net中运行以下代码: try { Response.Clear(); Response.ContentType = "application/zip"; Response.AddHeader("content-disposition", "attachment;filename=MyBigFile.zip"); Response.TransmitFile(Server.MapPath("~/Stuff/MyBigFile.zip"));
try
{
Response.Clear();
Response.ContentType = "application/zip";
Response.AddHeader("content-disposition", "attachment;filename=MyBigFile.zip");
Response.TransmitFile(Server.MapPath("~/Stuff/MyBigFile.zip"));
Response.Flush();
}
catch (Exception ex)
{
Logger.Error("File download failed", ex);
}
问题是,在下载完成之前,用户无法导航到我网站上的任何其他页面(我发现这一点是因为用户似乎正在手动取消下载,因为它经常引发异常。远程主机关闭了连接。错误代码为0x800703E3。
)
如何让下载在后台生成,并允许我的用户在下载时继续浏览网站?看起来我发现了问题-会话状态
在页面上设置
似乎可以解决问题。此错误消息仅表示服务器与客户端失去连接。阅读一些可能的线索的答案。谢谢-我刚刚意识到潜在的问题是,在下载完成之前,网站似乎被锁定(通过IE和Chrome验证),所以我更新了问题