473,503 Members | 13,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Response.OutputStream truncates XmlTextWriter?

(ASP.NET 2.0. Issue presents both on my copy of IIS on my workstation
(XP Pro) and my production server (Win2k3). I don't use any proxy
servers, anti-spyware apps, etc. Problem occurs using IE6SP2 and
Firefox 1.5.02.)

I'm writing large, sever-generated XML files to the browser.

This method works:

Dim xmltxt As New System.IO.StringWriter
Dim xml As New XmlTextWriter(xmltxt)
' xml.WriteStartDocument, etc....
Response.Write(xmltxt.ToString)

This, however, truncates the response a few KB shy:

Dim xml As New XmlTextWriter(Response.OutputStream, Encoding.UTF8)
' xml.WriteStartDocument, etc....
Response.Flush()

I've also tried with Response.Buffer=False, to no avail. At first I
didn't have the Flush() call, added it just in case, but it's not
helping either.

The length of the generated document doesn't seem to matter. A 40KB
document is truncated, as is a 600KB. The amount of trunctation *may*
be proportionate to the full document size, but I haven't found the
pattern.

I would just give up and use what works, but my usual documents are
MUCH larger than 600KB, more on the order of 30-50MB, so I'm running
into memory issues buffering in StringWriter and I need to dump it to
the browser as it is generated.

Cheers,

--Richard

Apr 26 '06 #1
1 4144
Doh!

Flushing the Response wasn't the issue, flushing the XmlTextWriter was.
Added:

- Response.Flush()
+ xml.Flush()

Works fine now...

--Richard

Apr 26 '06 #2

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

Similar topics

1
2915
by: Neil Woodvine | last post by:
***Scenario ... I have a DataList with a hyperlink WebControl in the Item Template. I want to display a 64x64 image in the Hyperlink and set the NavigateURL to the full size image. ***Source...
14
595
by: Hugh Welford | last post by:
Hi - trying to display a memo field using response.write but it truncates it. Is there a size issue with response.write? If so how do I get round it and to be able to display the whole memo field ...
3
13723
by: Zoury | last post by:
Hi folks ! :O) I'm trying to show a PDF in ASP.NET but I can't get to work properly. here's a portion of my code : '** Dim ms As MemoryStream =...
6
9791
by: Joseph | last post by:
Hi! I have this webpage that contains some panels and buttons. I also want to output an Image to that same page, but when I save the image to the OutputStream using the Image.Save...
2
2503
by: Jenny | last post by:
My application generates images dynamic. These images are then used for an image button like in the beneath. Dim ob As Bitmap = New Bitmap(130, 30) Dim banner As Graphics =...
3
5065
by: Jenny | last post by:
Hi all, I'm using a second page to write dynamical generated images into the outputstream. This avoids using tmp-files on disc. My code-behind in the start aspx file is: 'Use second file to...
3
7681
by: John A Grandy | last post by:
When writing rss xml to the client browser , is there any reason to load the rss xml string into an XmlDocument and then Response.Write() the XmlDocument.OuterXML.ToString() ? option 1: ...
2
8391
by: darrel | last post by:
I was having issues before with my XML being sent to the browser as UTF16. Via my XmlTextWriter, was able to fix this by explicitely setting the encoding to UTF8: Dim objX As New...
3
2887
by: kellygreer1 | last post by:
PHP will alllow you to build up an entire page and before sending that out as the response.... you can grab all the text and do search and replaces, add comments, make more CSS/XHTML compliant,...
0
7212
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
7098
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
7296
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,...
0
5604
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,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1524
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 ...
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
405
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...

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.