Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Download a file then the next error message appear The connection with the server was reset

Reply
Thread Tools

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

 
 
Liensun
Guest
Posts: n/a
 
      05-03-2004
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.



 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      05-03-2004

"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


 
Reply With Quote
 
 
 
 
Liensun
Guest
Posts: n/a
 
      05-03-2004
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
>
>



 
Reply With Quote
 
Liensun
Guest
Posts: n/a
 
      05-03-2004
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
>
>



 
Reply With Quote
 
Aaron Bertrand - MVP
Guest
Posts: n/a
 
      05-03-2004
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
> >
> >

>
>



 
Reply With Quote
 
Galadan
Guest
Posts: n/a
 
      05-03-2004
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
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"The connection with the server was reset" error during large download hoenes1 ASP .Net 1 09-23-2008 10:46 AM
Reading of file by next of map file and by next of file descriptor. =?ISO-8859-2?Q?Miros=B3aw?= Makowiecki C++ 1 07-10-2007 02:46 AM
Help. SessionID is x then y then x then y BodiKlamph@gmail.com ASP General 0 09-03-2005 03:02 PM
CurrentElement->next = CurrentElement->next->next (UNDEFINED?) Deniz Bahar C Programming 2 03-09-2005 12:45 AM
Download a file then the next error message appear The connection with the server was reset Liensun ASP General 5 05-03-2004 06:13 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57