title: FormUrlEncodedContent parameters on httpclient post
body: <p>I have to post into a html form listed below. </p>
  
  <pre><code>&lt;input type="text" name="user[username]" value=""&gt;
  &lt;input type="password" name="user[password]" &gt;
  </code></pre>
  
  <p>With rest sharp it works without any problem - code bellow : </p>
  
  <pre><code>var clientRest = new RestClient(url);
  var restRequest = new RestRequest();
  
  restRequest.Method = Method.POST;
  restRequest.AddParameter("user[username]", username);
  restRequest.AddParameter("user[password]", password);
  restRequest.AddHeader("Content-Type", "application/x-www-form-urlencoded");
  
  IRestResponse responseRestSharp = clientRest.Execute(restRequest);
  string content = responseRestSharp.Content;
  </code></pre>
  
  <p>But when i try that self with the HttpClient provided by System.Net.Http i dont get loged in into the session on the response - code bellow : </p>
  
  <pre><code>HttpClient client = new HttpClient();
  client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(@"application/x-www-form-urlencoded"));
  
  var content = new FormUrlEncodedContent(new[]
    {
      new KeyValuePair&lt;string, string&gt;("user[username]", username),
      new KeyValuePair&lt;string, string&gt;("user[password]", password)
  
      string response = client.PostAsync(url, content).Result.Content.ReadAsStringAsync().Result;
      ....
  </code></pre>
  
  <p>Im asking myself if the <code>FormUlrEncodedContent</code> transforms correctly it into a <code>name="user[username]"</code>  and <code>name="user[password]"</code> like restsharp does it with its AddParameter.</p>