title: c# Build URL encoded query from model object for HttpClient
body: <p>Need to build URL encoded query from model object for HttpClient</p>
  
  <p>My Model is </p>
  
  <pre><code>class SaveProfileRequest
  {
      public string gName { get; set; }
      public string gEmail { get; set; }
      public long gContact { get; set; }
      public string gCompany { get; set; }
      public string gDeviceID { get; set; }
      public string Organization { get; set; }
      public string profileImage { get; set; }
      public string documentImagefront { get; set; }
      public string documentImageback { get; set; }
  }
  
  SaveProfileRequest request = new SaveProfileRequest() { gName = name, gEmail = email, gContact = phonenumber, gCompany = company,
              gDeviceID = deviceId, Organization = "", profileImage = "", documentImageback = "", documentImagefront = "" };
  
  string response = await RequestProvider.PostAsync&lt;string, SaveProfileRequest&gt;(uri, request);
  </code></pre>
  
  <p>I have a working code for content type JSON</p>
  
  <pre><code>content = new StringContent(JsonConvert.SerializeObject(data));
  
  content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
  </code></pre>
  
  <p>Where data is of type TInput</p>
  
  <p>Tried</p>
  
  <pre><code>content = new StringContent(System.Net.WebUtility.UrlEncode(JsonConvert.SerializeObject(data)));
  
  content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
  </code></pre>
  
  <p>but didn't workout</p>