I have a ASP.NET Web API 2 project that's been set up to return JSONP (using the ASP.NET Web API Contrib repo from GitHub (https://github.com/WebApiContrib)), now Everything looks fine and dandy in my web application when consuming the API via jQuery.
However, there's also a windows application that needs access to the same data, but I'm quite at a loss on how to process the response in the c# class.
I have this code, which worked nicely (using JSON.NET) when the API returned plain JSON:
public List<DropItem> GetAvailableDomains()
{
string jsonData = null;
using (WebClient wc = new WebClient())
{
jsonData = wc.DownloadString("http://foo.bar/api/core/getavailabledomains");
}
return JsonConvert.DeserializeObject<List<DropItem>>(jsonData);
}
However, using JSONP it simply doesn't recognize that response data due to the overhead stuff with callback functions etc in the response.
Is there a good way of handling this?