title: Possible authentication problem? Loading a JSON via WebClient in Silverlight 4
body: <p>I'm playing with Silverlight 4, and I when my page loads, I call</p>
  
  <pre><code>beginGet("my/people/", new OpenReadCompletedEventHandler(continueLoadStamData));
  </code></pre>
  
  <p>that I have defined as </p>
  
  <pre><code>private void beginGet(string endpoint, OpenReadCompletedEventHandler callback)
  {
    WebClient wc = new WebClient();
    wc.Credentials = new NetworkCredential(username, password);
    wc.OpenReadCompleted += callback;
    wc.OpenReadAsync(new Uri(baseURL + endpoint));
  }
  </code></pre>
  
  <p>and continueLoadStamData()</p>
  
  <pre><code>void continueLoadStamData(object sender, OpenReadCompletedEventArgs e)
  {
    JsonObject root = (JsonObject)JsonObject.Load(e.Result);
  }
  </code></pre>
  
  <p>My problem is that when I get to e.Result, it throws an exception. It is the same exception I get as when I tried to use <code>WebRequest req = ...; req.Credentials = new NetworkCredential(username, password)</code>:</p>
  
  <pre><code>{System.Reflection.TargetInvocationException: An exception occurred during the operation, making the result invalid.  Check InnerException for exception details. ---&gt; System.Net.WebException: An exception occurred during a WebClient request. ---&gt; System.NotImplementedException: This property is not implemented by this class.
     at System.Net.WebRequest.set_Credentials(ICredentials value)
     at System.Net.WebClient.GetWebRequest(Uri address)
     at System.Net.WebClient.OpenReadAsync(Uri address, Object userToken)
     --- End of inner exception stack trace ---
     --- End of inner exception stack trace ---
     at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
     at System.Net.OpenReadCompletedEventArgs.get_Result()
     at JSONSample.MainPage.continueLoadStamData(Object sender, OpenReadCompletedEventArgs e)
     at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e)
     at System.Net.WebClient.OpenReadOperationCompleted(Object arg)}
  </code></pre>
  
  <p>Do you have any idea of what's going on, how I can make sure basic authentication is implemented and get my request going?</p>
  
  <p>Cheers</p>
  
  <p>Nik</p>