title: HTTP POST request works in Postman but doesn't work in code
body: <p>There's an external API, and I have to post some objects to it to get some data.</p>
  
  <p>I tried it in Postman, and it works fine as you see below:</p>
  
  <p><a href="https://i.stack.imgur.com/GeG4x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GeG4x.png" alt="enter image description here"></a></p>
  
  <p>And I tried it in my ASP.NET MVC application written in C# as well:</p>
  
  <pre><code>public class TestingController : SurfaceController
  {
      [System.Web.Http.HttpGet]
      public async System.Threading.Tasks.Task&lt;ActionResult&gt; Hit()
      {
          HttpClient client = new HttpClient();
          client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded"));
  
          ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
  
          Order order = new Order();
          ClientDetailsModel ClientDetails = new ClientDetailsModel();
          ProductDetailsModel ProductDetails = new ProductDetailsModel();
          ShippingAdressModel ShippingAdress = new ShippingAdressModel();
  
          ClientDetails.ClientName = "x";
          ClientDetails.Email = "x";
          ClientDetails.Note = "x";
          ClientDetails.Tel = "x";
  
          ProductDetails.ColorID = "1";
          ProductDetails.Quantity = "1";
          ProductDetails.SizeID = "1";
          ProductDetails.ProductMatrixRecordID = "1";
  
          ShippingAdress.City = "x";
          ShippingAdress.CountryID = "1";
          ShippingAdress.PostalAddress = "x";
          ShippingAdress.Street = "x";
          ShippingAdress.StreetAddress = "x";
  
          order.ResponseType = "JSON";
          order.Token = "P74kXRjM4W44l9qNw8u3";
          order.PaymentMode = "1";
          order.ProductDetails = ProductDetails;
          order.ShippingAddress = ShippingAdress;
          order.ClientDetails = ClientDetails;
          order.CurrencyAbbreviation = "JOD";
  
          var response = await client.PostAsJsonAsync&lt;Order&gt;("https://bmswebservices.itmam.com/OrderingManagement/Orders.asmx/PlaceOrder", order);
          response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
  
          if (!response.IsSuccessStatusCode)
          {
              Console.WriteLine("ERROR:  Products Not Posted." + response.ReasonPhrase);
              return null;
          }
  
          var cs = await response.Content.ReadAsAsync&lt;Order&gt;();
  
          return Json(cs); 
      }
  }
  </code></pre>
  
  <p>I got HTTP 500 internal server error:</p>
  
  <p><a href="https://i.stack.imgur.com/9vYBl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9vYBl.png" alt="enter image description here"></a></p>
  
  <p>Note: I used the same way for another APIs but the difference in for this one is sending entire objects to the server.</p>
  
  <p>Anyone can help in how to apply objects to server with the content-type <code>application/x-www-form-urlencoded</code>?</p>