How to send a post request with the C# client with a string as a parameter

Viewed 53

I am trying to send a string with a POST request. enter image description here

however when I do this the parameter is still null enter image description here

1 Answers

For a simple scenario, you can pass the parameter in the URL with PostAsync() method. You don't need to create an extra object or anything

await httpClient.PostAsync("https://localhost:60500/LogInfo?message=Test message", null);

Not sure if this is a good idea, but you can check another question here HTTP POST with URL query parameters -- good idea or not?

Related