I have a C# ASP webpage that is creating a KML document, and it's working fine. It's generating all the locations properly. The problem is that, as it generates the file, it appends the entire web source code to the file.
Below is the beginning of the code that generates the file, and I'm guessing the problem is somewhere there.
context.Response.ContentType = "application/vnd.google-earth.kml+xml";
context.Response.AddHeader("Content-Disposition", "attachment;
filename=Results.kml");
XmlTextWriter kml = new XmlTextWriter(context.Response.OutputStream, System.Text.Encoding.UTF8);
kml.Formatting = Formatting.Indented; kml.Indentation = 3;
kml.WriteStartDocument();
Thank you for your help.
You need to close response stream after document is written there. It can be done by calling Response.CompleteRequest()