c# httpclient postasync stringcontent
private static async Task PostBasicAsync(object content, CancellationToken cancellationToken)
{
using (var client = new HttpClient())
using (var request = new HttpRequestMessage(HttpMethod.Post, Url))
{
var json = JsonConvert.SerializeObject(content);
using (var stringContent = new StringContent(json, Encoding.UTF8, "application/json"))
{
request.Content = stringContent;
using (var response = await client
.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, cancellationToken)
.ConfigureAwait(false))
{
response.EnsureSuccessStatusCode();
}
}
}
}
Also in C#:
- c# fileupload example
- rotate player unity
- how do loops on C#
- unity indestructible
- create new object from generic c#
- can send but cannot receive email dreamhost email
- c# get enum in list
- C# datareadeer return null
- c# new list object
- C# Cast double to float
- c# convert column name to number
- C# get all files in directory
- c sharp check if key in dictionary
- SETTING UP ARRAY FOR TEST SCORES IN C#
- generic repository pattern c#
- interop C# save as and replace
- c# display float with 2 decimal places
- c# string array
- if and c#
- datatable return column names
- usermanager change password without current password
- c# compare type
- c# max two values
- how to reference function in unity