I want to return a View() from an action, and the resulting response should have a content type of text/xml instead of the default text/html.
I have tried the following, with no success:
Response.ContentType = "text/xml";
return View();
I know that you can specify the content type by returning ContentResult
, but that doesn't render my View.
I'm hoping I don't need to render the view to a string then use return Content()
, so I'm probably overlooking some easy way.
question from:
https://stackoverflow.com/questions/971806/asp-net-mvc-and-text-xml-content-type 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…