473,398 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Receive server error while downloading file using Response.BinaryW

I have been getting the following server errors sporadically while
downloading excel, csv or xml file.

Internet Explorer cannot download <file name> from <IP address>
"The server returned an invalid or unrecognized response" /
"The connection with the server was reset"

I'm using Response.BinaryWrite to send down the file content as attachment
(sample codes is attached below). I read some of the similar posts in the
newsgroup about the size of the download that may have caused this error.
After some testing with different size of download(12KB to 40MB), it doesn't
seem to make any difference. Even the 12KB download sometimes gets the error.
I have checked the file format , IIS log file and event log and they all
seems to be fine. I am hitting the wall here and I greatly appreciate it if
anyone can help. BTW, I am using IIS 6 on Win 2003 server. Thanks.

------------------------------------------------------------------------------
Response.ContentType = "application/excel";
Response.AddHeader("Content-Disposition", "attachment; filename=report.xls");
Response.BinaryWrite(byteContent);
Response.Flush();
Response.Close();
Nov 19 '05 #1
3 3840
I would make sure to clear the response first and if you have tried
everything, what about using Response.WriteFile instead?
http://msdn.microsoft.com/library/de...filetopic1.asp

Just a couple ideas...

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Jocelyn Duhaylungsod" <Jo*****************@discussions.microsoft.com> wrote
in message news:D7**********************************@microsof t.com...
I have been getting the following server errors sporadically while
downloading excel, csv or xml file.

Internet Explorer cannot download <file name> from <IP address>
"The server returned an invalid or unrecognized response" /
"The connection with the server was reset"

I'm using Response.BinaryWrite to send down the file content as attachment
(sample codes is attached below). I read some of the similar posts in the
newsgroup about the size of the download that may have caused this error.
After some testing with different size of download(12KB to 40MB), it doesn't seem to make any difference. Even the 12KB download sometimes gets the error.

I have checked the file format , IIS log file and event log and they all
seems to be fine. I am hitting the wall here and I greatly appreciate it if anyone can help. BTW, I am using IIS 6 on Win 2003 server. Thanks.

-------------------------------------------------------------------------- ---- Response.ContentType = "application/excel";
Response.AddHeader("Content-Disposition", "attachment; filename=report.xls"); Response.BinaryWrite(byteContent);
Response.Flush();
Response.Close();

Nov 19 '05 #2
Thanks for your reply.
In fact, the downloaded file is a byte array coming out from SQL Server
Reporting Service. I don't have the actual file stored in the server. It is
why I can't use the WriteFile().

I'll definitely try to clear the response first and retest it again.
-----------------------------------------------------------------------------
"Karl Seguin" wrote:
I would make sure to clear the response first and if you have tried
everything, what about using Response.WriteFile instead?
http://msdn.microsoft.com/library/de...filetopic1.asp

Just a couple ideas...

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Jocelyn Duhaylungsod" <Jo*****************@discussions.microsoft.com> wrote
in message news:D7**********************************@microsof t.com...
I have been getting the following server errors sporadically while
downloading excel, csv or xml file.

Internet Explorer cannot download <file name> from <IP address>
"The server returned an invalid or unrecognized response" /
"The connection with the server was reset"

I'm using Response.BinaryWrite to send down the file content as attachment
(sample codes is attached below). I read some of the similar posts in the
newsgroup about the size of the download that may have caused this error.
After some testing with different size of download(12KB to 40MB), it

doesn't
seem to make any difference. Even the 12KB download sometimes gets the

error.


I have checked the file format , IIS log file and event log and they all
seems to be fine. I am hitting the wall here and I greatly appreciate it

if
anyone can help. BTW, I am using IIS 6 on Win 2003 server. Thanks.

--------------------------------------------------------------------------

----
Response.ContentType = "application/excel";
Response.AddHeader("Content-Disposition", "attachment;

filename=report.xls");
Response.BinaryWrite(byteContent);
Response.Flush();
Response.Close();


Nov 19 '05 #3
Sorry... :o(
I did have the Response.ClearContent(); call in the codes before setting up
the response stream for attachment.
---------------------------------------------------------------------------
"Karl Seguin" wrote:
I would make sure to clear the response first and if you have tried
everything, what about using Response.WriteFile instead?
http://msdn.microsoft.com/library/de...filetopic1.asp

Just a couple ideas...

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Jocelyn Duhaylungsod" <Jo*****************@discussions.microsoft.com> wrote
in message news:D7**********************************@microsof t.com...
I have been getting the following server errors sporadically while
downloading excel, csv or xml file.

Internet Explorer cannot download <file name> from <IP address>
"The server returned an invalid or unrecognized response" /
"The connection with the server was reset"

I'm using Response.BinaryWrite to send down the file content as attachment
(sample codes is attached below). I read some of the similar posts in the
newsgroup about the size of the download that may have caused this error.
After some testing with different size of download(12KB to 40MB), it

doesn't
seem to make any difference. Even the 12KB download sometimes gets the

error.


I have checked the file format , IIS log file and event log and they all
seems to be fine. I am hitting the wall here and I greatly appreciate it

if
anyone can help. BTW, I am using IIS 6 on Win 2003 server. Thanks.

--------------------------------------------------------------------------

----
Response.ContentType = "application/excel";
Response.AddHeader("Content-Disposition", "attachment;

filename=report.xls");
Response.BinaryWrite(byteContent);
Response.Flush();
Response.Close();


Nov 19 '05 #4

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

Similar topics

3
by: Bruno G. | last post by:
Hello! Is it possible for IIS to send some sort of notification when an ASP error occurs on a page? I can see them in the web logs, but I was wondering if there was a way to receive an email...
6
by: Daniel Rimmelzwaan | last post by:
I want to send a biztalk document to an aspx page, and I need to see some sample code, because I just can't make it work. I have a port with transport type HTTP, pointing to my aspx page, something...
5
by: kevin | last post by:
Hi, Any help with this would be really appreciated! I'm trying to download a file from a remote server. The access permissions is okay but the problem I'm facing is that the file is getting...
0
by: Amol Guttal via .NET 247 | last post by:
(Type your message here) -------------------------------- From: Amol Guttal Hi, This is the code which used to download a file from webserver. If I point a file in my localhost for download...
4
by: whoopdaddy | last post by:
We are streaming a PDF file out of an ASPX page in IIS 5 using Response.WriteFile so the user does not need permissions to the directory where the files are stored. This works great when the user is...
2
by: Bala | last post by:
Hi I am trying to download the PDF files from my webserver using ASP.Net. All my files are stored at F Drive on webserver. Like this F:\Main Folder\Sub Folder\Files\File1.pdf I am...
4
by: Richard L Rosenheim | last post by:
I know that I can download a file from a web server by using the WebClient.DownloadFile method. But, does anyone know of an example of downloading a file from a web server with the ability to...
2
by: Tomas Martinez | last post by:
Hi there! I'm trying to download a file in my asp.net web, but when downloading it from a Firefox browser, instead of downloading the example.exe file, it's downloading example.exe.htm. My code...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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,...

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.