title: HttpClient not supporting PostAsJsonAsync method C#
body: <p>I am trying to call a web API from my web application. I am using .Net 4.5 and while writing the code I am getting the error <code>HttpClient</code> does not contain a definition <code>PostAsJsonAsync</code> method.</p>
  
  <p>Below is the code:</p>
  
  <pre><code>HttpClient client = new HttpClient();
  client.BaseAddress = new Uri("http://localhost:51093/");
  client.DefaultRequestHeaders.Accept.Add(
     new MediaTypeWithQualityHeaderValue("application/json"));
  var user = new Users();
  user.AgentCode = 100;
  user.Remarks = "Test";
  user.CollectionDate = System.DateTime.Today;
  user.RemittanceDate = System.DateTime.Today;
  user.TotalAmount = 1000;
  user.OrgBranchID = 101;
  
  var response = client.PostAsJsonAsync("api/AgentCollection", user).Result;
  </code></pre>
  
  <p>and I am getting the error message: </p>
  
  <blockquote>
    <p>Error:  'System.Net.Http.HttpClient' does not contain a definition for
    'PostAsJsonAsync' and No extension method 'PostAsJsonAsync' accepting a first argument of
    type     'System.Net.Http.HttpClient' could be found (are you missing
    a using directive or an assembly reference?)</p>
  </blockquote>
  
  <p>Please have a look  and advice me.</p>