title: HTTP Basic Auth for Diigo using C#: How to read response?
body: <p>I am (trying) to develop a WPF (C#) app that just gets (or at least is supposed to get) my saved bookmarks at Diigo.com profile. The only helpful page i found is <a href="http://www.diigo.com/tools/api" rel="nofollow">this</a> . It says i have to use HTTP Basic authetication to get my self authenticated and make requests then. But don't understand how C# handles it!. The only solution i came up with below just prints entire HTML source to console window.</p>
  
  <pre><code>string url = "http://www.diigo.com/sign-in";
  
  WebRequest myReq = WebRequest.Create(url);
  string usernamePassword = "&lt;username&gt;:&lt;password&gt;";
  CedentialCache mycache = new CredentialCache();
  mycache.Add(new Uri(url), "Basic", new NetworkCredential("username", "password"));
  myReq.Credentials = mycache;
  myReq.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(new     ASCIIEncoding().GetBytes(usernamePassword)));
   //Send and receive the response
  WebResponse wr = myReq.GetResponse();
  Stream receiveStream = wr.GetResponseStream();
  StreamReader reader = new StreamReader(receiveStream, Encoding.UTF8);
  string content = reader.ReadToEnd();
  Console.Write(content);
  </code></pre>
  
  <p>Here username and password are hardcoded but of course they'll come from some <code>txtUsername.Text</code> thing. And after that how am i going to read the JSON response and parse it?
   What is that i need to do to get my app or myself HTTP basic authenticated?
   Any help or suggestion is welcome!</p>