473,698 Members | 2,601 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 4158
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
2939
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
13773
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
9809
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 the same time? How do I append to the Response.OutputStream? Many thanks!
2
2519
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
5077
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
7701
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
8427
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 then reading it in as a stringreader, then transforming that via an
3
2895
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: System.ArgumentException: Stream was not readable. On this line: StreamReader sr = new...
0
8683
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9170
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8904
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
7741
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6531
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5867
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
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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
3
2007
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.