How to return an XML string as an action result in MVC

Viewed 51854
4 Answers

You could use return this.Content(xmlString, "text/xml"); to return a built XML string from an action.

For JSON/XML I have written an XML/JSON Action Filter that makes it very easy to tackle without handling special cases in your action handler (which is what you seem to be doing).

Related