I cant seem to download the JSON for the questions on SO, I cant get the HTML and JSON from other addresses, but the SO API always returns jibberish.
Here is my code:
public void BeginGetAllRecentQuestions()
{
WebClient client = new WebClient();
client.Headers = new WebHeaderCollection();
client.DownloadStringCompleted += DownloadRecentQuestionsStringCompleted;
client.DownloadStringAsync(new Uri("http://api.stackoverflow.com/1.0/questions?key=MYKEYHERE", UriKind.Absolute));
}
private void DownloadRecentQuestionsStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
var resultsString = e.Result;
Console.WriteLine(resultsString);
}
I just want basic JSON text returned, but all I ever get is, what looks like, strangley encoded text, which is not right.
I have tried other JSON URL's and they work fine. Its just this URL that fails.
Can someone please try out this code and help me out?