I have an ASP.Net Web API project which already contains controllers to return result in JSON format. Now I have to add new controllers which should receive and return only XML. I know that I can use the following option to push controllers to return XML serialized objects:
GlobalConfiguration.Configuration.Formatters.XmlFormatter.UseXmlSerializer = true
But, if I do it, I expect that the old controllers will also return data in XML format, right? This not what I need. So, how can I achieve my goal and return XML serialized objects only from some of controllers? Thank you.
UPDATE
I have tried suggested approach, but it does not work for me. I am testing using Fiddler. Please pay attention that result is still JSON (the last screenshot) Here is additional information:
Controller:
Request class:
Response class:
Request in Fiddler:
Response in Fiddler: