473,569 Members | 2,573 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Response.Output Stream 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.Strin gWriter
Dim xml As New XmlTextWriter(x mltxt)
' xml.WriteStartD ocument, etc....
Response.Write( xmltxt.ToString )

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

Dim xml As New XmlTextWriter(R esponse.OutputS tream, Encoding.UTF8)
' xml.WriteStartD ocument, 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 4148
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
2920
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 Data Item for Databinding is a class with 2 props ... URL Description ***MyMainPage.aspx Page_Load Code ...
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 Thanks in advance Hugh
3
13746
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 = DirectCast(m_report.FormatEngine.ExportToStream(reqContext), MemoryStream) If (fileName Is Nothing) Then
6
9798
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 (Response.OutputStream) method, the panels and buttons get overwritten and only the image appears. Is there a way to preserve the buttons and output the image at...
2
2504
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 = Graphics.FromImage(ob) Dim tempfilepath As String = System.IO.Path.GetTempPath ob.Save(tempfilepath & "temp.jpg", Imaging.ImageFormat.Jpeg)
3
5069
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 write into outputstream Application("grafix-obj") = ob button.ImageUrl = "Grafix.aspx"
3
7693
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: string rssXml = null; -- build rssXML -- Response.Write(rssXml);
2
8401
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 XmlTextWriter(Response.OutputStream, Encoding.UTF8) That fixed the issue. I'm not generating an XML file using a different method grabbing XML from a DB and...
3
2889
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, etc... I have bee trying to do the same thing in ASP.NET by manipulating the Response.OutputStream. I keep getting the error: Exception Details:...
0
7614
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...
0
7924
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. ...
1
7676
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...
0
6284
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...
1
5513
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
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...
1
2114
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
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
938
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...

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.