Friday, July 29, 2016

Secret sauce for your webapi - to always return json formatted result

Add this to your App_Start\RegisterWebAPIRoutes.cs file or wherever you happen to register your webapi routes

config.Formatters.Insert(0, new JsonpMediaTypeFormatter());
reference: http://stackoverflow.com/questions/10514047/how-do-i-handle-jsonp-with-webapi