write file in buffer

  • Thread starter Thread starter Rahul
  • Start date Start date
R

Rahul

I want to create/write XML file using streamwriter or something in buffer
and redirect it to client without storing it on the server's harddisk in
ASP.NET 2.0

Rahul
 
Rahul said:
I want to create/write XML file using streamwriter or something in buffer
and redirect it to client without storing it on the server's harddisk in
ASP.NET 2.0

Rahul

You have many options. You can use a StringBuilder directly to put the
string together, you can use a StringBuilder as temporary storage and a
StringWriter to write to it, or you can use a MemoryStream as temporary
storage and use a StreamWriter or an XmlTextWriter to write to it.

If you use a MemoryStream as temporary storage, you have to reset it and
read from it again to get the text as a string, while you can get a
string directly from a StringBuilder. On the other hand, the
XmlTextWriter may be handy for creating the XML.

If you use a writer, rememeber to flush it before getting the string.

/Göran Andersson
___
http://www.guffa.com
 
Back
Top