Recently I started on ASP.NET WEB API, created some code for demo purpose. I realized that the response can be either XML or JSON based on request header. To give it a try I opened the web API in IE and Mozilla, and yes IE showed JSON result and Mozilla showed XML result. So now the question is- can I see the same results in both the browsers irrespective of the request header value?Yes, this can be done, In Global.asax Application_Start() add below line before ConfigureApi(GlobalConfiguration.Configuration);GlobalConfiguration.Configuration.Formatters.JsonFormatter.SupportedMediaTypes.Clear();So now the results in both the browsers are same that is- XML.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: