title: Unable to consume Web Api Service from .NET 3.5 application
body: <p>I have a web api service that I've created as part of a separate project, and I can connect and consume the service without any problem by using HttpClient in .NET 4 and 4.5.  However, HttpClient is not supported in .NET 3.5, and I need to be able to consume this service from an existing .NET 3.5 application.  I've tried using WebClient, but it doesn't work.  Here's my code:</p>
  
  <pre><code>WebClient client = new WebClient();
  client.Headers.Add("content-type", "application/json");
  
  string serialisedData = JsonConvert.SerializeObject(DATA);
  
  var response = client.UploadString(URI, serialisedData);
  
  var result = JsonConvert.DeserializeObject(response);
  </code></pre>
  
  <p>I've tried the solutions using WebClient offered here: 
  <a href="https://stackoverflow.com/questions/22397865/call-web-apis-in-c-sharp-using-net-framework-3-5">Call web APIs in C# using .NET framework 3.5</a> and here:
  <a href="http://www.thepicketts.org/2012/11/how-to-access-webapi-from-a-net-3-5-client-in-c/" rel="nofollow noreferrer">http://www.thepicketts.org/2012/11/how-to-access-webapi-from-a-net-3-5-client-in-c/</a></p>
  
  <p>and this solution includes HttpClient code, event though it isn't even supported: 
  <a href="http://forums.asp.net/t/1982540.aspx?Consume+Web+API+in+project" rel="nofollow noreferrer">http://forums.asp.net/t/1982540.aspx?Consume+Web+API+in+project</a></p>
  
  <p><strong>What am I doing wrong when trying to connect to web api using .NET 3.5?</strong></p>