Hi I’m trying to return a view that is xml, meaning the content type will be “text/xml”, and the view is using ASP.NET MVC razor. Another post ASP.NET MVC and text/xml content type showed how to do it with aspx view. How do I get the same done with razor?
Share
I found an example of an rss feed produced with a razor view here:
Basically you have to set the
Response.ContentTypeto"text/xml", and then you can just write your xml as if it was html.You have to scroll down to see the actual code so I’ll copy it here:
by Mikesdotnetting