[英]How to send a post request with the C# client with a string as a parameter
For a simple scenario, you can pass the parameter in the URL with PostAsync()
method.对于一个简单的场景,您可以使用
PostAsync()
方法传递 URL 中的参数。 You don't need to create an extra object or anything您不需要创建额外的 object 或任何东西
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?不确定这是否是一个好主意,但您可以在此处查看另一个问题HTTP POST with URL 查询参数——好主意与否?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.