How do you set the Content-Type header for an HttpClient request?
I’m trying to set the Content-Type header of an HttpClient object as required by an API I am calling.
I’m trying to set the Content-Type header of an HttpClient object as required by an API I am calling.
What should be the HttpClient lifetime of a WebAPI client?
Is it better to have one instance of the HttpClient for multiple calls?
How do I add a custom header to a HttpClient request? I am using PostAsJsonAsync method to post the JSON. The custom header that I would need to be added is
I have a WebApi service handling an upload from a simple form, like this one:
I am building a class library to interact with an API. I need to call the API and process the XML response. I can see the benefits of using HttpClient for Asynchronous connectivity, but what I am doing is purely synchronous, so I cannot see any significant benefit over using HttpWebRequest.
I’m working on an integration with Alternative Payments using their hosted page integration. Their C# SDK does not have this integration available at the moment, but as you can see it’s pretty simple and I made a small class to send the post request and get the JSON response.
I’m writing an application that proxies some HTTP requests using the ASP.NET Web API and I am struggling to identify the source of an intermittent error.
It seems like a race condition… but I’m not entirely sure.
I am creating an application in .Net Core 2.1 and I am using http client for web requests. The issue is I have to send parallel calls to save time and for that I am using Task.WhenAll() method but when I hit this method I get the error “This instance has already started one or more requests. Properties can only be modified before sending the first request” Previously I was using RestSharp and everything was fine but I want to use httpclient. Here is the code:
I’m implementing a Proxy for my application using ASP.NET WebApi (ApiController) and using HttpClient to make the request with my authorization header. It works fine, but it’s extremely slow. Below is the main code, then the Global initialization (with DefaultConnectionLimit) and web.config related piece.
In my asp.net core MVC application, I’m using HttpClientFactory to create HttpClient object for requests to API server.