Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 01:05 PM
Liensun
Guest
 
Posts: n/a
Default 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 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.



  #2  
Old July 19th, 2005, 01:05 PM
Ray at
Guest
 
Posts: n/a
Default 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$nSdSMEHA.2532@TK2MSFTNGP10.phx.gbl...[color=blue]
> The application is coded using ASP.net and C#.[/color]

http://www.aspfaq.com/5004
http://www.aspfaq.com/5002

Ray at work


  #3  
Old July 19th, 2005, 01:05 PM
Liensun
Guest
 
Posts: n/a
Default 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.phx.gbl...[color=blue]
>
> "Liensun" <toto@titi.fr> wrote in message
> news:eb$nSdSMEHA.2532@TK2MSFTNGP10.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]


  #4  
Old July 19th, 2005, 01:05 PM
Liensun
Guest
 
Posts: n/a
Default 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.phx.gbl...[color=blue]
>
> "Liensun" <toto@titi.fr> wrote in message
> news:eb$nSdSMEHA.2532@TK2MSFTNGP10.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]


  #5  
Old July 19th, 2005, 01:05 PM
Aaron Bertrand - MVP
Guest
 
Posts: n/a
Default 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
http://www.aspfaq.com/




"Liensun" <toto@titi.fr> wrote in message
news:uLpgYvSMEHA.2592@tk2msftngp13.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.phx.gbl...[color=green]
> >
> > "Liensun" <toto@titi.fr> wrote in message
> > news:eb$nSdSMEHA.2532@TK2MSFTNGP10.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]


  #6  
Old July 19th, 2005, 01:06 PM
Galadan
Guest
 
Posts: n/a
Default 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:uLpgYvSMEHA.2592@tk2msftngp13.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.phx.gbl...[color=green]
> >
> > "Liensun" <toto@titi.fr> wrote in message
> > news:eb$nSdSMEHA.2532@TK2MSFTNGP10.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]


 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles