Using MCV4 for returning XML



I am using MCV4, but the what is returns is always JSON, by using "get" function.


I want to return an XML or simple text, and not "JSON" format (which always prompt me to save it).


I have checked webapiconfig:



public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}


but I didn't realize where to declare that the output is "simple text" (and not json auto converted).


Also - how can I output to xml?


Thanks :)


No comments:

Post a Comment