0

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);
}

The problem is that the user cannot navigate to any other page on my website until the download is completed (I found this because it looks like users are manually cancelling the download because it often throws the exception The remote host closed the connection. The error code is 0x800703E3.)

How can I get the download to spawn in the background, and allow my users to keep browsing the site while they are downloading?

steve cook
  • 3,116
  • 3
  • 30
  • 51
  • This error message simply means the server lost connection to the client. Read answers to [The remote host closed the connection. The error code is 0x800704CD](http://stackoverflow.com/questions/5564862/the-remote-host-closed-the-connection-the-error-code-is-0x800704cd) for some possible leads. – Karl Anderson Sep 13 '13 at 02:48
  • Thanks - I just realised the underlying problem is that the website seems locked until the download is complete (verified with IE and Chrome), so I've updated the question – steve cook Sep 13 '13 at 02:56

1 Answers1

0

Looks like I've found the issue - with session state.

Setting <%@ EnableSessionState="ReadOnly" %> on the page seems to fix the problem.

steve cook
  • 3,116
  • 3
  • 30
  • 51