I am trying to use HttpContent
:
HttpContent myContent = HttpContent.Create(SOME_JSON);
...but I am not having any luck finding the DLL where it is defined.
First, I tried adding references to Microsoft.Http
as well as System.Net
, but neither is in the list. I also tried adding a reference to System.Net.Http
but the HttpContent
class is not available.
So, can anyone tell me where I can find the HttpContent
class?
Just use...
var stringContent = new StringContent(jObject.ToString());
var response = await httpClient.PostAsync("http://www.sample.com/write", stringContent);
Or,
var stringContent = new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json");
var response = await httpClient.PostAsync("http://www.sample.com/write", stringContent);