(104) Connection reset by peer during Response.TransmitFile

Discussion in 'ASP.NET / ASP.NET Core' started by AndrewC, Aug 1, 2010.

  1. Hi i'm getting this error when I go to download a PDF from the site. I have a second sever in AUS (not a discount asp server) that runs the exact same system with no error. Any help would be great.

    Code
    Code:
                
    Response.Clear();
    Response.ContentType = "application/pdf";
    Response.AppendHeader("Content-Disposition", "attachment; filename=" + info.Name);
    Response.AddHeader("Content-Length", info.Length.ToString());
    Response.TransmitFile(filePath);
    Response.Flush();
    Response.Close();
    Response.End();
    
    Error
    Unable to display page

    It has not been possible to display the page you requested for the following reason:
    Read Error. An error condition occurred while reading data from the network. The system returned:
    (104) Connection reset by peer
    - Please retry your request.
    Contact your system administrator if you continue to experience difficulties.
     
  2. Fixed

    Changed to:

    Code:
    Response.ClearHeaders();
    Response.ClearContent();
    Response.ContentType = "application/octet-stream";
    Response.AddHeader("content-disposition", "attachment; filename=" + info.Name);
    Response.AddHeader("Content-Length", info.Length.ToString());
    Response.WriteFile(Filepath);
    Response.End();
     
  3. mjp

    mjp

    Thanks for posting the fix!
     

Share This Page