title: Webclient DownloadString Freezing the main Form
body: <p>hope somebody can help me with my problem.</p>
  
  <p>I am trying to get the html code of a web site using the following code: </p>
  
  <pre><code>        public string DownloadString(string add)
          {
              string html = "";            
              using (WebClient client = new WebClient())
              {
                  client.Proxy = null;
                  client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
                  while (html == "")
                  {
                      try
                      {
                          html = client.DownloadString(add);
  
                      }
                      catch (WebException e)
                      {
                          html = "";
                      }
                  }
                  client.Dispose();
              }
              return html;
          }
  </code></pre>
  
  <p>And I need the string in this function(Caller):</p>
  
  <pre><code>        public HtmlNode get_html(string add)
          {
              add_val(add);
              Uri madd = new Uri(add);
              Stopwatch timer = Stopwatch.StartNew();
              Task&lt;string&gt; task = Task.Factory.StartNew&lt;string&gt;
          (() =&gt; DownloadString(add));
              string html = task.Result;
              //string html = DownloadString(add);
              HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
              //doc.Load(new StringReader(html));
              doc.LoadHtml(html);
              HtmlNode root = doc.DocumentNode; 
              timer.Stop();
              TimeSpan timespan = timer.Elapsed;
              label18.Text = String.Format("{0:00}:{1:00}:{2:00}", timespan.Minutes, timespan.Seconds, timespan.Milliseconds / 10);            
              return root;
          }
  </code></pre>
  
  <p>I have tried <code>html = await client.DownloadStringTaskAsync(new Uri(add));</code> but it doesn't seem to work, it still freezes the UI when i download a string.</p>
  
  <p>Thank you in advance!</p>