title: How to POST using HTTPclient content type = application/x-www-form-urlencoded
body: <p>I am currently developing a wp8.1 application C#, i have managed to perform a POST method in json to my api by creating a json object (bm) from textbox.texts.
  here is my code below. How do i take the same textbox.text and POST them as a <code>content type = application/x-www-form-urlencoded</code>. whats the code for that?</p>
  <pre><code>Profile bm = new Profile();
  bm.first_name = Names.Text;
  bm.surname = surname.Text;
  
  string json = JsonConvert.SerializeObject(bm);
  
  MessageDialog messageDialog = new MessageDialog(json);//Text should not be empty 
  await messageDialog.ShowAsync();
  
  HttpClient client = new HttpClient();
  client.DefaultRequestHeaders.Clear();
  client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(&quot;application/json&quot;));
  client.DefaultRequestHeaders.TryAddWithoutValidation(&quot;Content-Type&quot;, &quot;application/json&quot;);
  
  byte[] messageBytes = Encoding.UTF8.GetBytes(json);
  var content = new ByteArrayContent(messageBytes);
  content.Headers.ContentType = new MediaTypeHeaderValue(&quot;application/json&quot;);
  var response = client.PostAsync(&quot;myapiurl&quot;, content).Result;
  </code></pre>