473,778 Members | 6,976 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.

Jul 19 '05 #1
5 2510

"Liensun" <to**@titi.fr > wrote in message
news:eb******** ******@TK2MSFTN GP10.phx.gbl...
The application is coded using ASP.net and C#.


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

Ray at work
Jul 19 '05 #2
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: #U************* @TK2MSFTNGP09.p hx.gbl...

"Liensun" <to**@titi.fr > wrote in message
news:eb******** ******@TK2MSFTN GP10.phx.gbl...
The application is coded using ASP.net and C#.


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

Ray at work

Jul 19 '05 #3
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: #U************* @TK2MSFTNGP09.p hx.gbl...

"Liensun" <to**@titi.fr > wrote in message
news:eb******** ******@TK2MSFTN GP10.phx.gbl...
The application is coded using ASP.net and C#.


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

Ray at work

Jul 19 '05 #4
No, this is a newsgroup for CLASSIC ASP.

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


"Liensun" <to**@titi.fr > wrote in message
news:uL******** ******@tk2msftn gp13.phx.gbl...
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: #U************* @TK2MSFTNGP09.p hx.gbl...

"Liensun" <to**@titi.fr > wrote in message
news:eb******** ******@TK2MSFTN GP10.phx.gbl...
The application is coded using ASP.net and C#.


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

Ray at work


Jul 19 '05 #5
oui et non. Car tu as mis plusieurs newsgroup dans ton entête.

"Liensun" <to**@titi.fr > a écrit dans le message de
news:uL******** ******@tk2msftn gp13.phx.gbl...
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: #U************* @TK2MSFTNGP09.p hx.gbl...

"Liensun" <to**@titi.fr > wrote in message
news:eb******** ******@TK2MSFTN GP10.phx.gbl...
The application is coded using ASP.net and C#.


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

Ray at work


Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5664
by: - - Pierre | last post by:
Hi all, I'm trying to come up with a script and I'm having a heck of a time... I require users to enter the size (in MB or KB) of the attachment they wish to transfer/upload. As they enter the number and move over to the next field (using onBlur or...), I would like a popup/alert window warning them that this attachment size would take "x" amount of time based on a speed of 24 kilobits per second (kbps). If they are happy with the...
4
6439
by: Li Weng | last post by:
Hi, I have two questions: 1) If there are more than one attachments, can I still use urn:schema:httpmail:attachmentfilename to get the file names? How? Or I need to use X-MS-ENUMATTS method? 2) After I get the filenames of the attachments, how do I download them to a local folder? Thanks in advance.
5
3379
by: Thomas Andersson | last post by:
Hi, I am trying to find a working solution for download of large files (400-800 MB)... But this seems almost impossible to find a working example. I have tried Response.Transmitfile, this works for some people…but in my case the server reset the connection after approx. 20 minutes and sometimes after 7-8 minutes…the download speed is however very good 400MB takes about 10
4
1090
by: Liensun | last post by:
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)
0
1898
by: hoenes1 | last post by:
Hi all, I'm trying to send files to a client following the instructions of http://support.microsoft.com/?id=812406 Everything works fine, but if files are large and/or if the bandwidth is small, after a certain time, the error "The connection with the server was reset" occurs. I think the time span when this error occurs relates closely to the IIS HTTP Connection timeout setting which is by
5
12308
by: Neil Rossi | last post by:
I have an issue with a particular ASP page on two web servers. Let's call these servers Dev1 and Beta1. Both Servers are running IIS 5, Windows 2000 SP4 with "almost" all of the latest patches. On Beta1, I am able to execute a particular page with no problem, that page opens up in the comes up just fine. On Win2kdev1, when I go to execute the same page, it opens a file download dialog and asks me whether I want to open or save the...
0
2038
by: bonita | last post by:
If I add the code for user to download the file (e.g. if(File.Exists(FILE_NAME)){......}), the ASP.NET will give the following timeout error: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. It seems that the download file code is executing before letting the previous code to finish. Even the message print code (message.Text="...";) is not executed.
2
6967
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of attending interviews. If you own a company best way to judge if the candidate is worth of it. http://www.questpond.com/InterviewRatingSheet.zip
1
47485
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
9629
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9470
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10127
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10069
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8957
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4033
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.