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

Discussion in 'ASP General' started by Liensun, May 3, 2004.

  1. Liensun

    Liensun Guest

    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 SendPageToBrowser(string filename)

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

    FileInfo fi = new FileInfo(Server.MapPath(filename));
    // Checks also that the file exists before cleaning the response
    // in case, it doesn't exist, an exception is raised
    string FileLength = fi.Length.ToString();
    Response.BufferOutput=true;
    Response.Clear();
    Response.ClearHeaders();
    Response.ClearContent();
    Response.ContentType = MimeTypeList[fi.Extension];
    if (Response.ContentType == null)
    {
    Response.ContentType = MimeTypeList["*"];
    }
    Response.AppendHeader("Content-Disposition","attachment;filename=" +
    fi.Name);
    Response.AppendHeader("Content-Length", FileLength);
    if (fi.Length < LOWER_LIMIT)
    {
    Response.WriteFile(fi.FullName );
    }
    else
    {
    Byte[] Buffer = new Byte[CHUNKSIZE];
    FileStream DLFile = fi.OpenRead();
    while ((Response.IsClientConnected)
    && (DLFile.Read(Buffer,0,CHUNKSIZE) != 0)
    )
    {

    Response.BinaryWrite(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.
     
    Liensun, May 3, 2004
    #1
    1. Advertising

  2. Liensun

    Ray at Guest

    Ray at, May 3, 2004
    #2
    1. Advertising

  3. Liensun

    Liensun Guest

    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: #...
    >
    > "Liensun" <> wrote in message
    > news:eb$...
    > > The application is coded using ASP.net and C#.

    >
    > http://www.aspfaq.com/5004
    > http://www.aspfaq.com/5002
    >
    > Ray at work
    >
    >
     
    Liensun, May 3, 2004
    #3
  4. Liensun

    Liensun Guest

    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: #...
    >
    > "Liensun" <> wrote in message
    > news:eb$...
    > > The application is coded using ASP.net and C#.

    >
    > http://www.aspfaq.com/5004
    > http://www.aspfaq.com/5002
    >
    > Ray at work
    >
    >
     
    Liensun, May 3, 2004
    #4
  5. No, this is a newsgroup for CLASSIC ASP.

    --
    Aaron Bertrand
    SQL Server MVP
    http://www.aspfaq.com/




    "Liensun" <> wrote in message
    news:...
    > 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: #...
    > >
    > > "Liensun" <> wrote in message
    > > news:eb$...
    > > > The application is coded using ASP.net and C#.

    > >
    > > http://www.aspfaq.com/5004
    > > http://www.aspfaq.com/5002
    > >
    > > Ray at work
    > >
    > >

    >
    >
     
    Aaron Bertrand - MVP, May 3, 2004
    #5
  6. Liensun

    Galadan Guest

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

    "Liensun" <> a écrit dans le message de
    news:...
    > 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: #...
    > >
    > > "Liensun" <> wrote in message
    > > news:eb$...
    > > > The application is coded using ASP.net and C#.

    > >
    > > http://www.aspfaq.com/5004
    > > http://www.aspfaq.com/5002
    > >
    > > Ray at work
    > >
    > >

    >
    >
     
    Galadan, May 3, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Liensun
    Replies:
    5
    Views:
    573
    Galadan
    May 3, 2004
  2. hoenes1
    Replies:
    1
    Views:
    7,192
    captdes
    Sep 23, 2008
  3. Deniz Bahar
    Replies:
    2
    Views:
    492
    Andrey Tarasevich
    Mar 9, 2005
  4. =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki

    Reading of file by next of map file and by next of file descriptor.

    =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki, Jul 10, 2007, in forum: C++
    Replies:
    1
    Views:
    810
    Alf P. Steinbach
    Jul 10, 2007
  5. Replies:
    0
    Views:
    313
Loading...

Share This Page