Good day
I want to return a response body but my code is only returning a Status message. Please help
static async Task PostURI(Uri u, HttpContent c)
{
var response = string.Empty;
using (var client = new HttpClient())
{
HttpResponseMessage result = await client.PostAsync(u, c);
if (result.IsSuccessStatusCode)
{
response = result.StatusCode.ToString();
}
}
return response;
}
Uri u = new Uri("URL");
var payload = results;
HttpContent c = new StringContent(payload, Encoding.UTF8, "application/json");
var t = Task.Run(() => PostURI(u, c));
t.Wait();
Console.WriteLine(t.Result);
Console.ReadLine();

Mithun PattankarRank #1,446 · 1.1K reputationPosted Mar 19, 2019, 10:20 PM EDT
Shrimant TelgaveRank #623 · 3.8K reputationPosted Mar 19, 2019, 10:30 PM EDT
unathi guma45 reputationPosted Mar 20, 2019, 2:51 AM EDT
Mithun PattankarRank #1,446 · 1.1K reputationPosted Mar 20, 2019, 5:14 AM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Mar 22, 2019, 6:47 AM EDT