title: JSON request is null when POSTing with WebClient but working with WebRequest, HttpClient
body: <p>I have developed a Web API 2 application having the following Action</p>
  
  <pre><code>[Route("submit")]
          [HttpPost]
          public async Task&lt;IHttpActionResult&gt; Submit([FromBody]Request request)
          {
              if (request != null)
              {
                  try
                  {
                      //Do Something
                  }
                  catch (Exception ex)
                  {
                      return this.InternalServerError(ex);
                  }
              }
              else
              {
                  return this.BadRequest("Request is null");
              }
          }
  </code></pre>
  
  <p>In my client application, if I use WebClient to call this action, the request object in the action is coming null. </p>
  
  <p><strong>Using WebClient - Not Working</strong> </p>
  
  <pre><code>private static void CallWebAPIUsingWebClient(string dataString, TokenResponse token, string url)
          {            
              using (WebClient client = new WebClient())
              {
                  client.Headers[HttpRequestHeader.ContentType] = "application/json";
                  client.Headers[HttpRequestHeader.Accept] = "application/json";
                  client.Headers.Add("Username", "WebClient");
                  client.UploadString(url, "POST", dataString);
              }
          }
  </code></pre>
  
  <p>But, if i use WebRequest or HttpClient even, I am getting the complete request object in the action.</p>
  
  <p><strong>Using WebRequest - Working</strong></p>
  
  <pre><code>private static void CallWebAPIUsingWebRequest(string dataString, TokenResponse token, string url)
          {
              var httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
              httpWebRequest.Accept = "application/json";
              httpWebRequest.ContentType = "application/json";
  
              httpWebRequest.Method = "POST";
              httpWebRequest.Headers.Add("Username", "WebRequest");
  
              using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
              {
                  streamWriter.Write(dataString);
                  streamWriter.Flush();
                  streamWriter.Close();
              }
  
              var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
              using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
              {
                  string result = streamReader.ReadToEnd();
              }
          }
  </code></pre>
  
  <p><strong>Using HttpClient - Working</strong></p>
  
  <pre><code>private async static Task CallWebAPIUsingHttpClient(string dataString, TokenResponse token, string url)
          {
              using (HttpClient client = new HttpClient())
              {
                  client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                  client.DefaultRequestHeaders.Add("Username", "HttpClient");
                  await client.PostAsync(url, new StringContent(dataString, System.Text.Encoding.UTF8, "application/json"));
              }
          }
  </code></pre>
  
  <p>The strange thing is, even <code>WebClient</code> was working till yesterday.
  Please let me know why, in particular, <code>WebClient</code> is not working.
  Thanks in advance.</p>