I'm having trouble getting a memory stream and a XML text writer class to work together properly.
Context.Reponse.BufferOutput=true;
Context.Response.ContentType = "application/xml";
stmOutput = new MemoryStream();
Output = new XmlTextWriter(stmOutput, Encoding.ASCII);
Output.WriteStartDocument();
Output.WriteStartElement("MyTag");
Output.WriteEndElement();
Output.WriteEndDocument();
Output.Flush();
stmOutput.Flush();
Context.Response.OutputStream.Write(stmOutput.ToArray(),0,(int)stmOutput.Length-1);
Context.Response.OutputStream.Flush();
Output.Close();
This is being done inside an ASHX file. When I run this, all that gets output is
<?xml version="1.0" encoding="us-ascii"?><MyTag /
Am I missing something with Response, or the memory stream or the XML text writer? I'm kinda lost because I'm following a little guide to it doing everything it shows but instead using a memory stream, and its not working. .