title: How to download an image from an URI and create a bitmap object from it?
body: <p>I'm trying to download image from a website and create bitmap based on that image. It looks like this:</p>
  
  <pre><code>    public void test()
      {
              PostWebClient client = new PostWebClient(callback);
              cookieContainer = new CookieContainer();
              client.cookies = cookieContainer;
              client.download(new Uri("SITE"));
      }
  
      public void callback(bool error, string res)
      {
              byte[] byteArray = UnicodeEncoding.UTF8.GetBytes(res);
  
              MemoryStream stream = new MemoryStream( byteArray );
              var tmp = new BitmapImage();
              tmp.SetSource(stream);
      }
  </code></pre>
  
  <p>I receive "Unspecified error" on last line of callback method. Interesting fact is that if I use BitmapImage(new Uri("SITE")) it works well... (I can't do this like that because I want to grab cookies from that URL. The image is an jpg.
  PostWebClient class -> <a href="http://paste.org/53413">http://paste.org/53413</a></p>