tagged [dotnet-httpclient]
How can I tell when HttpClient has timed out?
How can I tell when HttpClient has timed out? As far as I can tell, there's no way to know that it's specifically a timeout that has occurred. Am I not looking in the right place, or am I missing some...
- Modified
- 20 Jun at 09:12
Custom header to HttpClient request
Custom header to HttpClient request 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 Thi...
- Modified
- 16 Jul at 14:16
Re-Send HttpRequestMessage - Exception
Re-Send HttpRequestMessage - Exception I want to send the exact same request more than once, for example: Sending the req
- Modified
- 15 Nov at 12:37
Pass multiple complex objects to a post/put Web API method
Pass multiple complex objects to a post/put Web API method Can some please help me to know how to pass multiple objects from a C# console app to Web API controller as shown below? ``` using (var httpC...
- Modified
- 21 Jul at 23:55
HttpClient Not Saving Cookies
HttpClient Not Saving Cookies I am using the new HttpClient to handle my project's web surfing needs; However, although correctly set, the HttpClient does not save the cookies to the Cookie container ...
- Modified
- 20 Jun at 09:12
ASP.NET WebApi: how to perform a multipart post with file upload using WebApi HttpClient
ASP.NET WebApi: how to perform a multipart post with file upload using WebApi HttpClient I have a WebApi service handling an upload from a simple form, like this one: ```
- Modified
- 2 May at 17:20
Cancelling an HttpClient Request - Why is TaskCanceledException.CancellationToken.IsCancellationRequested false?
Cancelling an HttpClient Request - Why is TaskCanceledException.CancellationToken.IsCancellationRequested false? Given the following code: ``` var cts = new CancellationTokenSource(); try { // get a...
- Modified
- 30 Mar at 18:49
Net.HttpClient Cancel ReadAsStringAsync?
Net.HttpClient Cancel ReadAsStringAsync? I use `SendAsync` with `HttpCompletionOption.ResponseHeadersRead` to get the headers first. Next I check the `Content-Type` and `Content-Length` to make sure t...
- Modified
- 11 Feb at 10:52
How to trace all HTTP requests in .net core 2.1 globally?
How to trace all HTTP requests in .net core 2.1 globally? I want to log all HTTP requests in a dotnet core 2.1 application. Logging should include HTTP headers, body and the host address. I need to bi...
- Modified
- 9 Jul at 08:22
Adding a handler to all clients created via IHttpClientFactory?
Adding a handler to all clients created via IHttpClientFactory? Is there a way to add a handler to all clients created by the IHttpClientFactory? I know you can do the following on named clients: ``` ...
- Modified
- 1 Mar at 17:36
How to implement progress reporting for Portable HttpClient
How to implement progress reporting for Portable HttpClient I'm writing a library with intentions to use it in desktop (.Net 4.0 and up), phone (WP 7.5 and up) and Windows Store (Windows 8 and up) app...
- Modified
- 16 Jan at 18:9
Is HttpClient safe to use concurrently?
Is HttpClient safe to use concurrently? In all the examples I can find of usages of `HttpClient`, it is used for one off calls. But what if I have a persistent client situation, where several requests...
- Modified
- 23 Jan at 17:11
VSO REST API - Getting user profile image only works with basic authentication?
VSO REST API - Getting user profile image only works with basic authentication? I'm using the to get all members in a team, from there I'm getting the `ImageUrl` of the member. If I just bind an Image...
- Modified
- 11 Sep at 21:41
DelegatingHandler for response in WebApi
DelegatingHandler for response in WebApi I am currently using several delegation handlers (classes derived from `DelegatingHandler`) to work on the request before it is sent, for things like validatin...
- Modified
- 28 Feb at 18:50
How to post data using HttpClient?
How to post data using HttpClient? I have got [this](http://www.nuget.org/packages/Microsoft.Net.Http) HttpClient from Nuget. When I want to get data I do it this way: But the problem is that I don't ...
- Modified
- 20 Jun at 09:12
StringContent vs ObjectContent
StringContent vs ObjectContent I am using System.Net.Http's HttpClient to call a REST API with "POST" using the following code: The "objectContent" is currently thi
- Modified
- 8 Jun at 08:54
How to use credentials in HttpClient in c#?
How to use credentials in HttpClient in c#? I am facing some problems when using the HttpClient class to access to a Delicious API. I have the following code: ``` try { const string uriSources = "ht...
- Modified
- 10 Sep at 14:8
HttpClient vs HttpWebRequest
HttpClient vs HttpWebRequest I have a large file which I have to send to a web api client...The data is multi part. The issue is , if the file is sent over http web request, then it is uploaded quickl...
- Modified
- 6 Mar at 04:26
Async call with await in HttpClient never returns
Async call with await in HttpClient never returns I have a call I am making from inside a xaml-based, `C#` metro application on the Win8 CP; this call simply hits a web service and returns JSON data. ...
- Modified
- 12 Jul at 18:15
Adding authorization to the headers
Adding authorization to the headers I have the following code: ``` ... AuthenticationHeaderValue authHeaders = new AuthenticationHeaderValue("OAuth2", Contract.AccessToken); string result = await Post...
- Modified
- 1 Nov at 17:14
HttpRequestException vs WebException
HttpRequestException vs WebException This is a general question that I'm confused about. I thought once a REST request was made, an error would come back via a `WebException`. In one case I have I'm g...
- Modified
- 2 Sep at 00:42
C# Add Accept header to HttpClient
C# Add Accept header to HttpClient What is the difference between these two calls? My end goal is to have `Accept: application/json` sent over the wire, not to append to some default set of other MIME...
- Modified
- 26 Nov at 14:7
Get HTML Code from a website after it completed loading
Get HTML Code from a website after it completed loading I am trying to get the HTML Code from a specific website async with the following code: But the problem is that the website usually takes anothe...
- Modified
- 22 Dec at 19:10
Typed HttpClient vs IHttpClientFactory
Typed HttpClient vs IHttpClientFactory Is there any difference between the following 2 scenarios of setting up HttpClient? Should I prefer one to another? Typed client: ``` public class CatalogService...
- Modified
- 26 Jan at 13:15
How do you set the Content-Type header for an HttpClient request?
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 tried setting the `Content...
- Modified
- 1 Jan at 01:31