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
0 answers

Does HttpClient use different SecurityProtocol in Windows Service vs ASP.NET

I have Windows Service and ASP.NET application. Both the applications are sharing the same .Net Library that is internally using HttpClient class to make GET and POST request. When Windows Service is making the GET call via shared library, then i…
LP13
  • 30,567
  • 53
  • 217
  • 400
1
vote
1 answer

Xamarin.Android HttpClient PostAsync gets cancelled when in Release

My application utilizes a few REST API endopints using HttpClient. My GetAsyncs are working perfectly fine both when used in Debug and Release mode. The problem occurs when I try to PostAsync a large picture to the API in Release mode. The…
1
vote
0 answers

Using HttpClient to upload stream portions one at a time?

Is there any easy way to use HttpClient and upload stream portions? For example, open a file, set the starting point of the stream and tell how much content should be read from that point.
Pinco Pallino
  • 916
  • 1
  • 6
  • 18
1
vote
1 answer

Cannot add constructors after adding a handler to httpclient

Why can't I add authentication details after adding a DelegatingHandler? Prior to adding the DelegatingHandler, I was able to instantiate the HttpClient like so: var client = new HttpClient{Credentials = ..., BaseAddress = ...}; After having added…
Alex Gordon
  • 57,446
  • 287
  • 670
  • 1,062
1
vote
1 answer

HttpClient GetAsync disposes Webjob handler

I'm implementing an Azure WebJob which, when triggered by a Service Bus Message, performs an async API call to an external web service. After executing the web request, something odd happens to my webjob and the inputMessage has been disposed before…
Aero
  • 59
  • 6
1
vote
1 answer

Sending string via POST - unsupported media type or null parameter

My controller cannot accept string via POST method. What could be wrong? When I create HttpClient and send content like this : var content = new FormUrlEncodedContent(new [] { new KeyValuePair("signature", "someexamplecontent"),…
p__d
  • 443
  • 2
  • 7
  • 19
1
vote
1 answer

c# httpclient - disable ntlm

I'm using this code to connect to a third party server. using (HttpClientHandler httpClientHandler = new HttpClientHandler()) { httpClientHandler.AllowAutoRedirect = false; httpClientHandler.Credentials = new NetworkCredential(login,…
user3566056
  • 224
  • 1
  • 12
1
vote
1 answer

Exception: This instance has already started one or more requests. Properties can only be modified before sending the first request

I am using the Checkout.com .NET SDK to integrate my application with their REST API. I have written a proof-of-concept application and everything works fine, but when I try from the actual application I get this error when trying to make API calls:…
smartypants
  • 51
  • 1
  • 5
1
vote
1 answer

Xamrine Http call not returning response

I wanted to fetch and display data but its not working and after this line var response = await client.GetAsync(uri).ConfigureAwait(false); code never executed not even throw an exception public async Task> RefreshDataAsync() { …
1
vote
0 answers

HTTP Get with Body with HttpClient not possible due to ProtocolViolationException

I know why it is not recommended to have Http Get with body, see: HTTP GET with request body But I have a third-party service which is essentially a MongoDB PAAS which lets you query by sending a HTTP GET with body (the filter clause is in HTTP…
foresightyj
  • 2,006
  • 2
  • 26
  • 40
1
vote
1 answer

C# HttpClient.PostAsync and await crashing app

I am quite new to C#. I'm using the await keyword to invoke HttpClient's API. static async Task CreateChannel(string channelName) { try { HttpClient client = new HttpClient(); var req = new { …
victor
  • 1,626
  • 1
  • 14
  • 23
1
vote
1 answer

C# .Net Standard HttpClient Error while copying content to a stream

I am working on a .Net Standard class library and working on creating a library for the new Destiny 2 Api. I have one method working which is the search for a user to get their information. However, when I make a request to a different endpoint I…
Bailey Miller
  • 1,376
  • 2
  • 20
  • 36
1
vote
1 answer

HTTP proxy stripping authorization header requires cooke

I'm trying to use a REST API from behind a web proxy in my C# application that requires basic authentication. I've tested my credentials using the Postman chrome app, and verified that they work. However, when I run my C# application, I receive a…
Eugene S
  • 3,092
  • 18
  • 34
1
vote
2 answers

How to delete a listview item based on it's ID after button click? (C# UWP)

So I've done some googling with minimal results, but results nonetheless. What happens is the DB has 5 entries in CalendarEvents (basically name/place/date/time etc of events in the future). I get these from my DB and display them in a listview.…
Tempuslight
  • 1,004
  • 2
  • 17
  • 34
1
vote
0 answers

Parameter value becomes null at the second time, when one web api project ApiController calls another web api project ApiController, using HTTPClient

I try to file upload a 20MB file, I convert that file to contentAsBase64String format in angularjs(Client Side) and send to the FirstProject APIController. The First Project APIController is calling the Second Project APIController method. When I…