I'm getting some strange behavoir with my xml-ouput.
I'm filling my xml using a Stringwriter and a xmltextwriter.
Using textw As New IO.StringWriter
Using xmlw As New System.Xml.XmlTextWriter(textw)
....
End Using
However when outputting the data. i'm getting two different results for the same ('in my eyes') methodoligy. In both situations tw will contain my xml
Non working version: (in IE)
Response.Clear()
Response.Write(textw.ToString)
Response.ContentEncoding = System.Text.Encoding.UTF8
Response.ContentType = "text/xml"
Response.End()
Errormessage is telling there is an error in the contents of my xml.
working version: (in IE)
Response.Clear()
Dim xmlDoc As New XmlDocument
xmlDoc.LoadXml(textw.ToString)
xmlDoc.Save(Response.OutputStream)
Response.ContentEncoding = System.Text.Encoding.UTF8
Response.ContentType = "text/xml"
Response.End()
Question: What is the difference between Response.write
and Response.Outputstream
?
Note: Both method appear to be working in firefox & chrome. The xml is valid as its already in use at the moment (using the working version).