3,171 questions
0
votes
0
answers
67
views
How to send HTTP POST request with multipart/form-data with the form-data in initial request in .NET Framework?
I have to upload a file to an embedded device running an API.
First, I tried to write methods to do this in a test project. This works great:
private static async Task<HttpResponseMessage?> ...
0
votes
1
answer
62
views
Move HTTP request with cert file from nodeJs to .NET not working
I try to move a request with certificate from an old system made with NodeJS to a new system using .NET 8.0.
Running the .NET code, however, I always get the following error:
The SSL connection could ...
-3
votes
0
answers
76
views
HttpClient and headers
I have a legacy .NET 4.8 framework project.
I have tried to get these headers:
Accept-Encoding
CacheControl
sent to my endpoint.
But looking with Fiddler, they are not sent, even if I explicitly set ...
Best practices
0
votes
3
replies
59
views
Most efficient way to manage the lifecycle of HttpClient in many wrapper classes?
Our application is somewhat of a middleman that transforms data from numerous APIs. Initially to simplify things, we wrote a bunch of specific clients which wrap an instance of HttpClient created in ...
Best practices
2
votes
4
replies
74
views
How do I parse multipart content from an HttpResponseMessage?
I am using HttpClient in .NET 9 to get content that has a JSON part along with a base-64 encoded file. Reading the content as a string, I don't see a clear format that would ensure consistent parsing ...
0
votes
1
answer
182
views
C# Https call using HttpClient does work in Windows 7, but not in Windows 10
In Windows 7 32-bit, on .NET 4.6.1, this code works fine and the remote server is returning data:
using (HttpClient client = new HttpClient())
{
client.Timeout = TimeSpan.FromSeconds(3);
...
3
votes
2
answers
165
views
How to make system proxy settings apply to HttpClient.GetAsync() without restarting Windows?
We use the following function to test internet connectivity every 5 seconds. But in some part of the world, this function always returns false. Now, the problem is we can set a proxy server in Windows ...
1
vote
0
answers
60
views
Android HttpClient "Socket closed" error on slow connections, but server successfully processes request
I'm working on a .NET MAUI Android app that sends order data to a Web API using HttpClient. On normal Wi-Fi connections everything works fine, but when I throttle the network speed to around 56 kbps (...
1
vote
0
answers
65
views
HttpClient OAuth "No user found matching username"
I'm working on a console application to automatically interact with an API that needs and OAuth authorized user with a specific set of claims. If I use a browser to log in with a username and password ...
6
votes
3
answers
159
views
.NET IHttpClientFactory + Microsoft Resilience retry: same HttpRequestMessage resent, delegating handler not re-running?
I have an HttpClient built with IHttpClientFactory and Microsoft.Extensions.Http.Resilience retry on 401. Pipeline:
Primary: HttpClientHandler (AllowAutoRedirect = false)
Delegating: ....
2
votes
1
answer
121
views
Why am I getting a different HTTP response for a seemingly same request between curl, C# HttpClient Win10 and C# HttpClient Win11
I'm trying to download a webpage from a specific website (Bandcamp). I'm getting different results although the request seems the same:
On Windows 10, using a HttpClient in C#: I'm getting "...
1
vote
1
answer
105
views
Set-Cookie header disappears after some time when using HttpClient with DelegatingHandler in ASP.NET Core
I have a .NET Core project with two layers: an API layer and a UI layer, both in the same solution. The UI layer is built with ASP.NET Core MVC, where controllers call services, and the services use ...
4
votes
1
answer
159
views
Can't listen to 'http://127.0.0.100:50001/' with HttpListener on my machine, even though the port does not appear to be in use
My HttpListener for some reason can't listen to prefix http://127.0.0.100:50001/, getting an error
Unhandled exception. System.Net.HttpListenerException (32): The process cannot access the file ...
1
vote
0
answers
53
views
.NET HttpClient: How to read multiple responses from one request? [duplicate]
The http spec allows multiple responses per http request:
A single request can have multiple associated responses: zero or more "interim" (non-final) responses with status codes in the &...
0
votes
0
answers
52
views
.NET MAUI for Android in connection API localhost [duplicate]
I have a problem, I get this error
[0:] Connection failure: ERROR {0}
when using a connection in a .NET MAUI project for Android. I applied the Microsoft instruction for the case when the API works ...