473,789 Members | 2,629 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.

Nov 18 '05 #1
4 1090

"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
Nov 18 '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

Nov 18 '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

Nov 18 '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


Nov 18 '05 #5

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

Similar topics

5
2511
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
12309
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...
1
47490
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
9511
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
10199
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
10139
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
9983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6769
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();...
0
5417
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4092
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
3700
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.