title: Switching from httpwebrequest to httpclient and I can't figure out how to send my header?
body: <p>So, this is the code I was using</p>
  
  <pre><code>
  
      string URL = "http://www.test.com/posts/.json";
      var getInfo = (HttpWebRequest)HttpWebRequest.Create(URL);{
      getInfo.Headers["Cookie"] = CookieHeader;
      getInfo.ContentType = "application/x-www-form-urlencoded";
      using (WebResponse postStream = await getInfo.GetResponseAsync())
      {
          StreamReader reader = new StreamReader(postStream.GetResponseStream());
          string str = reader.ReadToEnd();
      }
  
  </code></pre>
  
  <p>and I want to switch to httpclient, which I've got working, except it doesn't pass the Cookie information.  I get the information, but just the anonymous information.  Not the information for the user that I'm sending across.  Here is what I currently have.</p>
  
  <pre><code>
  
      HttpClient client = new HttpClient();
      client.DefaultRequestHeaders.Accept.Add(
      new MediaTypeWithQualityHeaderValue("application/json"));
      client.BaseAddress = new Uri("http://www.test.com/");
      client.DefaultRequestHeaders.Add("Cookie", CookieHeader);
      HttpResponseMessage response = await client.GetAsync("http://www.test.com" + URL);
      string str;
      str = await response.Content.ReadAsStringAsync();
  
  </code></pre>