By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,480 Members | 763 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,480 IT Pros & Developers. It's quick & easy.

Receive server error while downloading file using Response.BinaryW

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.