title: How do I perform a simple GET request with cookies in C#
body: <p>Everything I find is either about a POST request or does not assume cookies.</p>
  
  <p>I have an URL like this:</p>
  
  <pre><code>http://page.com/find/1,1,1,find.html?advanced=1&amp;param1=val1&amp;param2[]=val2
  </code></pre>
  
  <p>When put into a browser, this will direct me to a search results page. Now I would like to replicate it in a C# program. I have this so far:</p>
  
  <pre><code>WebRequest req = WebRequest.Create(url);
  ((HttpWebRequest)req).UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2";
  req.Method = "GET";
  WebResponse response = req.GetResponse();
  </code></pre>
  
  <p>When I run it, it returns a "please login" page, as expected. But there is a problem with one of the parameters. This is the response URL:</p>
  
  <pre><code>http://page.com/login.html?ref=find/1,1,1,find.html?advanced=1&amp;param1=val1&amp;param2=Array
  </code></pre>
  
  <p>So, two questions: what might have happened to param2? And how do I add cookies to this?</p>
  
  <p>EDIT: Managed to set the cookies by casting to <code>HttpWebRequest</code>.</p>