I've been given a seemingly simple task.
When a given URL is requested the response should simply be some valid XML.
How do I achieve this?
The URL will contain all the necessary code behind to get the data and construct the correct XML string. How do you then go ahead and manipulate the response to return this string only? The caller is receiving the XML string and populating a database with it, that's there responsibility I just need to provide this part of the project.
Thanks
Take a look at this :
Response.Clear();
Response.Write(yourXml);
Response.ContentType = "text/xml";
Response.End();
I would go for an HttpHandler. This way you circumvent all asp.net control creation etc. which is better for performance and seeing as you will not be outputting any html there's no point in using an actual aspx page.
Assuming you have your XML string created you can clear the response and just write your string out.
Response.Clear();
Response.ContentType = "text/xml";
Response.Write(myXMLString);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With