24 questions
0
votes
2
answers
118
views
Can we configure HttpClientHandler in IHttpClientFactory DI implentation?
I'm getting multiple intermittent 'Socket Exception' error while using httpclient(IHttpClientFactory DI Implementation) .
As per MS documentation,
A new HttpClient instance is returned each time ...
1
vote
1
answer
80
views
Handle issue "PlatformNotSupportedException" for HttpClientHandler.SslProtocol in .netstandard2.0 project
I have .netstandard2.0 project which is used by two projects. One is .net core project and one is .netframework4.7.1. I'm getting "PlatformNotSupportedException" for HttpClientHandler....
0
votes
1
answer
42
views
Problem getting my application to log into webpage
The "*" are my credentials to log in, and are set to variables.
When I run the code, my returned value is a string stating my conditional statement, else value.
I am pretty sure I am ...
0
votes
0
answers
29
views
.NET HttpClientHandler with ServerCertificateCustomValidationCallback , how to add additional information to generated AuthenticationException [duplicate]
I am using a custom server validation callback based on
this example
private void InitServices(IHostBuilder builder, ...)
{
...
builder
.ConfigureServices((context, services) =>
{
...
0
votes
0
answers
143
views
VB.net FCM proxy 407 issue
I have a basic setup for Push Delivery, they are working fine without proxy. I tried to add a proxy setting but couldn't manage to make it work.
I am using below function to deliver push notifications:...
1
vote
1
answer
733
views
Use HttpClientHandler with ODataClient
I have a custom HttpClientHandler class which inherits from HttpClientHandler and for most scenarios it is used with the HttpClient as var client = new HttpClient(new CustomHttpClientHandler()) and it ...
2
votes
0
answers
1k
views
HttpClient with HttpClientHandler ClientCertificate not working in c#
I need to send data to a webapi which needs a certificate to authorize. This is working on .net 4.5.2 with WebRequestHandler but when I try to upgrade to dotnet 5 and using HttpClientHandler I got an ...
2
votes
0
answers
281
views
Detect "Is Client Certificate required" when using C# HttpClient
My client application calls an Azure App Service with HttpClient
Something like this:
HttpClientHandler handler = new HttpClientHandler();
if (I detect a certificate is needed)
{
httpClientHandler....
0
votes
1
answer
2k
views
httpClientHandler.ServerCertificateCustomValidationCallback never executed
I'm using Xamarin, in VS 2022, class libraries targeting .NetStanderd2.1, for Android.
I'd like to implement an HttpCient with custom SSL certificate validation.
Here's my code:
var httpClientHandler =...
0
votes
1
answer
183
views
Time out errors with multiple HttpClientHandler instance
We have written an application that connects with an external API. You need to have a Token to communicate with this api. The token have to be unique for each user. To obtain a token we need to call ...
1
vote
0
answers
239
views
c# add CookieContainer to HttpClientHandler
I have the following function written in c#:
public static string FunctionName()
{
try
{
using (var httpClient = new HttpClient())
{
var uri = new Uri("https://...
1
vote
0
answers
3k
views
How to implement ServerCertificateCustomValidationCallback from HttpClientHandler
I'm trying to implement a method for ServerCertificateCustomValidationCallback for an instance of HttpClientHandler class. I'm at a loss here because I don't know what to validate. I need to send a ...
1
vote
0
answers
339
views
dotnet 5 how to use windows authentication credentials in HttpClient
issue in .net 5 that not happen in .net core 3.1
the windows authentication didn't pass to HttpClient
this same code that work on .net core 3.1 :
[HttpGet("getuser")]
public async Task<...
0
votes
0
answers
704
views
Xamarin.Forms: default instead of AndroidClientHandler as HttpClient implementation
I work on an existing Xamarin.Forms app, where we need to integrate API calls to external providers.
For this, we use my client's custom HttpClient library.
Until now, the Android HttpClient was set ...
0
votes
0
answers
131
views
HttpClientHandler design clashing with Tests
I have Integration Tests failing when run at once, but pass if run separately.
The tests are for Service 1 which initializes dependent Service 2. Service 2 receives HttpClientHandler through DI where ...
1
vote
1
answer
601
views
await client.GetStringAsync(url) ERREUR
async void GetLieu(string place)
{
ShowProgressDialogue("Récupération des données...");
string MonURL = "https://hubeau.eaufrance.fr/api/v1/...
11
votes
2
answers
7k
views
How to pass HttpClientHandler to existing HttpClient?
I have HttpClient httpClient injected from outside of my class.
Inside my class I'm creating a new HttpClientHandler var handler = new HttpClientHandler() and setting its values.
I need to link ...
1
vote
1
answer
536
views
Access IMemoryCache service from AddHttpClient
I am using .NET Core 3.1.
On Startup, I am adding the following:
public void ConfigureServices(IServiceCollection services)
{
services.AddHttpClient<IApns, Apns>()....
13
votes
2
answers
6k
views
Access HttpClientHandler from HttpClient instance?
When working with a HttpClient instance and HttpClientHandler instance (.Net Framework, not using Core), is it possible to access the HttpClientHandler instance/its properties later in any way (for ...
0
votes
1
answer
2k
views
I am trying to apply a Proxy authentication through an HttpClient, in a .net standard1.3 library
.net Standard 1.3 means -> no WebProxy library. So I have created one, here it is :
public class WebProxy : IWebProxy, ISerializable
{
private readonly ArrayList _bypassList;
...
1
vote
1
answer
1k
views
Using Network Creds in dotnet core app on a mac using HttpClient
Writing a dotnet core app. I need to log in with network credentials as the service (which happens to be a TFS on-prem server) uses those to authenticate. From my (and another team members') windows ...
10
votes
1
answer
5k
views
Using SocketsHttpHandler in .NET Core 2.2 and ignoring cert validation
With HttpClientHandler, we are able to set a server validation callback and return true (by writing it out or using DangerousAcceptAnyServerCertificateValidator). How can I ensure that I bypass this ...
1
vote
1
answer
597
views
DelegatingHandler and HttpClient in a loop
I am trying to execute HttpClient.GetAsync in a loop.
As per Microsoft Doc, it is recommended to use 1 instance of HttpClient.
The way I'm getting HttpClient is
var httpClient = ...
5
votes
0
answers
3k
views
What are the Best Practices with using HttpClient & HttpClientHandler for multiple endpoints?
Using HttpClient is not as straight forward as I would've hoped. Despite it being an IDisposable type it is not best practice to wrap it in a using statement and it's even ideal to make it a ...