Today I needed to make an ASPX page return a simple XML document with some basic server information. The example below is over simplified but I think you can get the point. This is pretty easy as it turns out. Here are the steps:
- Create a new ASPX page in your solution just like you would any other page.
- Next remove everything from the markup except the @Page tag. It should look like this an have nothing more:
- Here is a code snippet of the page load event that returns a simple XML element:
That's it. I also found a nice post here that shows how to read XML from file and stream it back through the browser. Pretty simple and useful.