title: How to send cookie with HttpWebRequest in c#
body: <p>I've made short program with 6 textbox that I manually fill in with cookies. Now I want my program to act on specific url as if its logged in.</p>
  
  <p>How can I get that ? I tried this and I get http response that I'm not logged in.</p>
  
  <pre><code>            string url = "myurl string";
              Uri target = new Uri(url);
              CookieContainer gaCookies = new CookieContainer();
              gaCookies.Add(new Cookie("__utma", textBox1.Text) { Domain= target.Host});
              gaCookies.Add(new Cookie("__utmb", textBox2.Text) { Domain = target.Host });
              gaCookies.Add(new Cookie("__utmc", textBox3.Text) { Domain = target.Host });
              gaCookies.Add(new Cookie("__utmz", textBox4.Text) { Domain = target.Host });
              gaCookies.Add(new Cookie("cookiename1", textBox5.Text) { Domain = target.Host });
              gaCookies.Add(new Cookie("cookiename2", textBox6.Text) { Domain = target.Host });
              HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create(url);
              HttpWebResponse response = (HttpWebResponse)myReq.GetResponse();
              Stream receiveStream = response.GetResponseStream();
              StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
              textBox7.Text = readStream.ReadToEnd();
  </code></pre>