title: Change this from sync to async webrequests
body: <p>I ahve been diggin the net for some time now, not finding code examples that help me through my problem.. I have looked at example code but I'm still not "getting" it... </p>
  
  <p>I have read up on, </p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/aa480507.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/aa480507.aspx</a> and 
   <br> <a href="http://msdn.microsoft.com/en-us/library/dd781401.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/dd781401.aspx</a></p>
  
  <p>But I cant seem to get it to work.. </p>
  
  <p><strong>Im using HTMLAGILITYPACK</strong></p>
  
  <p>Today I make up to 20 webrequests, </p>
  
  <p><strong>After a request has finished, result is added to dictionary, after that a method searches it for the information, if found the code exits if not it makes another webrequest , until it caps at 20.</strong> I need to be able to exit all threads async calls when everything is found.</p>
  
  <p>It goes like this</p>
  
  <pre><code>public void FetchAndParseAllPages()
      {
          PageFetcher fetcher = new PageFetcher();
          for (int i = 0; i &lt; _maxSearchDepth; i += _searchIncrement)
          {
              string keywordNsearch = _keyword + i;
              ParseHtmldocuments(fetcher.GetWebpage(keywordNsearch));
              //this checks if the information was found or not, if 
              //found stop exit and add to database
  
              if (GetPostion() != 201)
              {   //ADD DATA TO DATABASE
                  InsertRankingData(DocParser.GetSearchResults(), _theSearchedKeyword);
                  return;
              }
          }
      }
  </code></pre>
  
  <p><strong>This is inside the class that fetches the page</strong></p>
  
  <pre><code>    public HtmlDocument GetWebpage(string urlToParse)
      {
  
          System.Net.ServicePointManager.Expect100Continue = false;
          HtmlWeb htmlweb = new HtmlWeb();
          htmlweb.PreRequest = new   HtmlAgilityPack.HtmlWeb.PreRequestHandler(OnPreRequest);
          HtmlDocument htmldoc = htmlweb.Load(@"urlToParse", "38.69.197.71", 45623, "PORXYUSER", "PROXYPASSWORD");
  
          return htmldoc;       
      }
  
      public bool OnPreRequest(HttpWebRequest request)
      {
         // request.UserAgent = RandomUseragent();
          request.KeepAlive = false;
          request.Timeout = 100000;
          request.ReadWriteTimeout = 1000000; 
          request.ProtocolVersion = HttpVersion.Version10;
          return true; // ok, go on
      }
  </code></pre>
  
  <p>How can I make this async and make it really quick with threads? Or should i even use threads when doing it async?</p>