title: C# Why DownloadStringAsync don't return result
body: <p>I want download string with timeout=10sec.  This code forever goto theEnd, and I can't understand why. </p>
  
  <pre><code>                    wc.DownloadStringCompleted += (ender,args)=&gt;
                      {
                          res = args.Result;
                          var cook = Regex.Matches(wc.ResponseHeaders.ToString(), "Set\\-Cookie:\\s*([\\w\\-_\\.]+\\s*=\\s*[^;]+)", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline);
                          foreach (Match val in cook)
                              cookies += val.Groups[1].Value.Trim() + "; ";
                      };
                      wc.DownloadStringAsync(new System.Uri(url));
  
                      int msec = 0;
                      while (String.IsNullOrEmpty(res))
                      {
                          Thread.Sleep(1);
                          ++msec;
                          if (msec &gt;= 10000)
                          {
                              lastError = "TimeOut";
                              goto theEnd;
                          }
                      }
                      return res;
  </code></pre>