Creating a RESTful Web Service Using ASP.Net MVC Part 23 – Bug Fixes and Area Support

June 6, 2010 00:04 by admin

Joel Feaster emailed to say he was having trouble with the Accept header handling of the web service. When he used jQuery’s getJSON method it would use the following Accept header:

application/json, text/javascript, */*

You’ll notice there are no q parameters in that header, so according to the HTTP 1.1 specification, they should all be treated as having a q value of 1. However, the specification does not dictate which format should take precedence when all acceptable formats have the same q value. But looking at that header and knowing it comes from a method named getJSON, you might hope the web service would pick application/json.

More...