Download a file then the next error message appear The connection with the server was reset

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Liensun

    Download a file then the next error message appear The connection with the server was reset

    The application is coded using ASP.net and C#.
    A part of the application allows the user to download files. The size of
    these field can be up to 80 MB.

    It works when the connection bandwidth is high. But in other cases, after a
    few minutes, the next messages is displayed: "The connection with
    server was reset".

    Here the code that I use:
    private void SendPageToBrows er(string filename)

    {
    // All mime type supports
    StringDictionar y MimeTypeList = new StringDictionar y();
    MimeTypeList[".doc"] = "applicatio n/ms-word";
    MimeTypeList[".zip"] = "applicatio n/zip";
    MimeTypeList["*"] = "applicatio n/octet-stream";

    FileInfo fi = new FileInfo(Server .MapPath(filena me));
    // Checks also that the file exists before cleaning the response
    // in case, it doesn't exist, an exception is raised
    string FileLength = fi.Length.ToStr ing();
    Response.Buffer Output=true;
    Response.Clear( );
    Response.ClearH eaders();
    Response.ClearC ontent();
    Response.Conten tType = MimeTypeList[fi.Extension];
    if (Response.Conte ntType == null)
    {
    Response.Conten tType = MimeTypeList["*"];
    }
    Response.Append Header("Content-Disposition","a ttachment;filen ame=" +
    fi.Name);
    Response.Append Header("Content-Length", FileLength);
    if (fi.Length < LOWER_LIMIT)
    {
    Response.WriteF ile(fi.FullName );
    }
    else
    {
    Byte[] Buffer = new Byte[CHUNKSIZE];
    FileStream DLFile = fi.OpenRead();
    while ((Response.IsCl ientConnected)
    && (DLFile.Read(Bu ffer,0,CHUNKSIZ E) != 0)
    )
    {

    Response.Binary Write(Buffer);
    Response.Flush( );
    }
    DLFile.Close();
    }
    Response.End();
    }

    What's wrong in my code or which settings of IIS I have to change?

    Any helps will be greatly appreciated.

    Olivier.



  • Ray at

    #2
    Re: Download a file then the next error message appear The connection with the server was reset


    "Liensun" <toto@titi.fr > wrote in message
    news:eb$nSdSMEH A.2532@TK2MSFTN GP10.phx.gbl...[color=blue]
    > The application is coded using ASP.net and C#.[/color]




    Ray at work


    Comment

    • Liensun

      #3
      Re: Download a file then the next error message appear The connection with the server was reset

      Exacte ecrit en asp. net et C# mais le probleme peut provenir d'un réglage
      de IIS.
      C'est pourquoi je l'ai posté sur les newsgroups qui me semblaient les plus
      approprié sinon merci de m'indiquer lequelle serait le mieux.

      "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> a écrit dans
      le message de news: #UaIOhSMEHA.140 @TK2MSFTNGP09.p hx.gbl...[color=blue]
      >
      > "Liensun" <toto@titi.fr > wrote in message
      > news:eb$nSdSMEH A.2532@TK2MSFTN GP10.phx.gbl...[color=green]
      > > The application is coded using ASP.net and C#.[/color]
      >
      > http://www.aspfaq.com/5004
      > http://www.aspfaq.com/5002
      >
      > Ray at work
      >
      >[/color]


      Comment

      • Liensun

        #4
        Re: Download a file then the next error message appear The connection with the server was reset

        Ben c'est du ASP.net c'est pas le but de ce groupe ????


        "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> a écrit dans
        le message de news: #UaIOhSMEHA.140 @TK2MSFTNGP09.p hx.gbl...[color=blue]
        >
        > "Liensun" <toto@titi.fr > wrote in message
        > news:eb$nSdSMEH A.2532@TK2MSFTN GP10.phx.gbl...[color=green]
        > > The application is coded using ASP.net and C#.[/color]
        >
        > http://www.aspfaq.com/5004
        > http://www.aspfaq.com/5002
        >
        > Ray at work
        >
        >[/color]


        Comment

        • Aaron Bertrand - MVP

          #5
          Re: Download a file then the next error message appear The connection with the server was reset

          No, this is a newsgroup for CLASSIC ASP.

          --
          Aaron Bertrand
          SQL Server MVP





          "Liensun" <toto@titi.fr > wrote in message
          news:uLpgYvSMEH A.2592@tk2msftn gp13.phx.gbl...[color=blue]
          > Ben c'est du ASP.net c'est pas le but de ce groupe ????
          >
          >
          > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> a écrit dans
          > le message de news: #UaIOhSMEHA.140 @TK2MSFTNGP09.p hx.gbl...[color=green]
          > >
          > > "Liensun" <toto@titi.fr > wrote in message
          > > news:eb$nSdSMEH A.2532@TK2MSFTN GP10.phx.gbl...[color=darkred]
          > > > The application is coded using ASP.net and C#.[/color]
          > >
          > > http://www.aspfaq.com/5004
          > > http://www.aspfaq.com/5002
          > >
          > > Ray at work
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Galadan

            #6
            Re: Download a file then the next error message appear The connection with the server was reset

            oui et non. Car tu as mis plusieurs newsgroup dans ton entête.

            "Liensun" <toto@titi.fr > a écrit dans le message de
            news:uLpgYvSMEH A.2592@tk2msftn gp13.phx.gbl...[color=blue]
            > Ben c'est du ASP.net c'est pas le but de ce groupe ????
            >
            >
            > "Ray at <%=sLocation% > [MVP]" <myfirstname at lane34 dot com> a écrit dans
            > le message de news: #UaIOhSMEHA.140 @TK2MSFTNGP09.p hx.gbl...[color=green]
            > >
            > > "Liensun" <toto@titi.fr > wrote in message
            > > news:eb$nSdSMEH A.2532@TK2MSFTN GP10.phx.gbl...[color=darkred]
            > > > The application is coded using ASP.net and C#.[/color]
            > >
            > > http://www.aspfaq.com/5004
            > > http://www.aspfaq.com/5002
            > >
            > > Ray at work
            > >
            > >[/color]
            >
            >[/color]


            Comment

            Working...