Thursday 12 September 2013

ASP.Net exceptions sending large attachment

ASP.Net exceptions sending large attachment

I'm running the following code in ASP.Net on IIS:
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);
}
However it often throws the exception:
The remote host closed the connection. The error code is 0x800703E3.
Why is this, and how can I prevent it?

No comments:

Post a Comment