Quantcast
Viewing all articles
Browse latest Browse all 2

Answer by Bryant for Possible authentication problem? Loading a JSON via WebClient in Silverlight 4

Based on Mark Monster's post here you're missing some lines of code in your beginGet method. It should be something like:

private void beginGet(string endpoint, OpenReadCompletedEventHandler callback){  WebRequest.RegisterPrefix("http://", System.Net.Browser.WebRequestCreator.ClientHttp);    WebClient wc = new WebClient();    wc.Credentials = new NetworkCredential(username, password);  wc.UseDefaultCredentials = false;   wc.OpenReadCompleted += callback;    wc.OpenReadAsync(new Uri(baseURL + endpoint));}

Also, if you're just trying to get JSON from the server, you should be able to use DownloadStringAsync instead of OpenReadAsync which might simplify things.


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>