Questions tagged [dotnet-httpclient]

Refers to the System.Net.Http.HttpClient library which is part of the HttpClient package on NuGet, or the .NET 4.5 library.

System.Net.Http.HttpClient is a general purpose HTTP client library, intended for use in REST applications or basic HTTP applications. It includes support for de-serializing responses in JSON and XML.

HttpClient was first released in 2008/9 as part of the WCF Starter Kit, which was released via Codeplex.

That HTTP Client library then graduated to a standalone package available via NuGet.

HttpClient will be subsumed into .NET with v4.5, retaining the fullname, namespace, and API, but changing the strong name.

This tag refers to all versions of that .NET library; It specifically excludes the similarly-named Java HttpClient library.

See also for proper HttpClient lifecycle management and creating typed clients.

2837 questions
1
vote
1 answer

How do I determine if a connected socket uses IPSec?

I am working on a Windows server application that will transfer sensitive information to another Windows server over a socket using an HTTPClient. The servers are supposed to be configured to use IPSec. So yay, I I don't have to do anything to…
Moby Disk
  • 3,761
  • 1
  • 19
  • 38
1
vote
0 answers

HttpClient Failing in asp.net web api

I have a very strange scenario I keep experiencing on one of my systems. I have an asp.net web API hosted in IIS. Web requests come into it from mobile devices, and then it posts HTTP requests to another server that executes the specific job and…
Zapnologica
  • 22,170
  • 44
  • 158
  • 253
1
vote
0 answers

Xamarin Forms Android error System.Net.WebExceptionStatus.TrustFailure

I am having a challenge with my Xamarin Forms Android app in Visual Studio 2015 Enterprise edition. Below is my helper class which makes all calls to my WebAPIs public string CallWebService(string ps_URI) { HttpClient…
1
vote
1 answer

SendAsync(httpclient) fails with InnerException - "The underlying connection was closed: An unexpected error occurred on a send.", but Fiddler not

I saw these post, but they did not work out: C# HttpWebRequest The underlying connection was closed: An unexpected error occurred on a send The underlying connection was closed: An unexpected error occurred on a send.--- NuGet You can find the…
Jane Kins
  • 43
  • 1
  • 6
1
vote
1 answer

HttpClient request is not working in asp .net Project

I am using HttpClient to make a request to an api. This code is located in a class library project shared with two aditional projects, a Console and a Asp.Net Mvc project. When I make a request from the Console project it works great, but in the asp…
aperezfals
  • 1,341
  • 1
  • 10
  • 26
1
vote
0 answers

Use proxy settings of the local machine in httpclient without requiring a password

When I installed google chrome, it automatically uses my PC's proxy settings and requests work fine. When I create a HttpClient I can only get the proxy to work if I provide my domain\username and password. Is there a way to get it to use the same…
NibblyPig
  • 51,118
  • 72
  • 200
  • 356
1
vote
1 answer

how to add 'Content-Type' header in (HTTP GET) Rest request header collection using HttpClient?

I am using HttpClient for rest service . At at one point I have a problem when I try to add "Content-Type" in my 'Get' request header . I know "Content-Type" is suitable for content send in request body part But It's my need i have to send…
Shubham
  • 183
  • 1
  • 3
  • 15
1
vote
0 answers

C# .net How to cancel/abort the web request started by GetAsync, the cancellation token passed in it only cancels the task not the actual rquest

i am using getAsync method of HttpClient in .net c# to make a web request, as below, when i use cancellationTokenSourceForTagDetails.cancel() it only cancels the task but not the request, in fiddler i can still see the request sent by this call…
shyam_
  • 2,370
  • 1
  • 27
  • 50
1
vote
2 answers

Bug when using await/async for System.Net.Http with .NET Core (.NET Standard 1.4 and .NET Framework 4.6.1)?

Foreground: I was investigating a bug in an ASP.NET Core project (targeting .NET 4.6.1, using assemblies from .Net Standard 1.4), that threw a MissingMethodException, although this in no way could be possible. Isolating the faulting method, I took…
gimlichael
  • 1,365
  • 1
  • 15
  • 28
1
vote
0 answers

HttpClient issues redundant SSL tunnels when used in parallel

I've observed some unusual SSL tunnel behavior when asynchronously sending multiple requests from System.Net.Http.HttpClient. I've isolated the problem to the following minimal working example (MWE): public async Task MinimalExample() { var c =…
DumpsterDoofus
  • 1,132
  • 12
  • 30
1
vote
1 answer

Singleton HttpClient handling

I am using a singleton instance of HttpClient to make my calls. I was wondering is there a way to test if the HttpClient is valid? Can this instance of HttpClient go bad during the life of the application where there would be a need to create a new…
Barbara
  • 11
  • 2
1
vote
1 answer

Run HttpClient POST in parallel

I am using .net HTTPClient to save some data using POST REST API. The payload size for this API is around 10 MB. I am splitting my data in chunks and calling this POST API for each chunk. I have question mostly around approach: I am planning to…
Abhay
  • 928
  • 1
  • 10
  • 28
1
vote
1 answer

Streaming HttpResponse through Owin

I have a HttpResponse object as a result of HttpClient.SendAsync() call. The response has a chunked transfer encoding and results in 1.5 GB of data. I want to pass this data through OWIN pipeline. To do this I need to convert it to a stream.…
bpiec
  • 1,561
  • 3
  • 23
  • 38
1
vote
1 answer

Set 'per request' cookie with .Net HttpClient

Hi I'm trying to implement simple http proxy service using Owin infrastructure. This proxy must authenticate user with windows authentication, pull user's properties from the enterprise AD, add this info as a cookie value into original request and…
Pavel Pykhtin
  • 353
  • 3
  • 11
1
vote
3 answers

Is there a utility to serialise an object as HTTP content type "application/x-www-form-urlencoded"?

I've never had to do this before, because it's always only been an actual form that I've posted as that content type, but recently I had to post three variables like that, and I resorted to a sordid concatenation with & and =: var content = new…
ProfK
  • 49,207
  • 121
  • 399
  • 775
1 2 3
99
100