C# – How to send synchronous requests with HttpClient
In .NET 5 and above, you can use the HttpClient Sync API methods – Send() and ReadAsStream() – to send HTTP requests synchronously (as opposed to resorting to sync-over-async). Here’s the steps for doing this: Create an instance of HttpRequestMessage. Use the synchronous HttpClient.Send() to send the message. Use the synchronous HttpContent.ReadAsStream() to get the … Read more