title: webclient or httpwebrequest to retrieve hrefs and url
body: <p>How do I use either webclient or httpwebrequest to do two things:</p>
  
  <p>1)Say after downloading the resource as a string using:</p>
  
  <pre><code> var result = x.DownloadString("http://randomsite.com);
  </code></pre>
  
  <p>there's a relative url(also query string):</p>
  
  <pre><code>&lt;a href="/q?name=john&amp;age=50"&gt;Click here to get your name and age&lt;/a&gt;
  </code></pre>
  
  <p>how do I click(follow) on that link using webclient? after initially loading the resource in result. i was able to use htmlagilitypack to isolate the href but I would now like to follow it in code.</p>
  
  <p>2) If the httpwebrequest does not redirect but instead loads the same page with different parameters how would i use webclient to retrieve the new url that is generated?
  i.e if i call</p>
  
  <pre><code>var result = x.DownloadString("http://randomsite.com);
  </code></pre>
  
  <p>but this actually calls</p>
  
  <pre><code>http://randomsite.com/q?site=default
  </code></pre>
  
  <p>I then want to retrieve the second url</p>
  
  <p>Thanks in advance</p>