Forum Xamarin.Android

How to configure SSL/TLS for WebClient?

atataatata Member ✭✭
edited February 12 in Xamarin.Android

Recently, I had to load a json to my app.
Surprisingly, I haven't found any HttpClient and VS haven't suggested any packages to use.
Nevertheless, I found WebClient which seemed to be a replace for HttpClient.
When I checked, how is it working it showed me 'Error: TrustFailure (Authentication failed, see inner exception.)'.
I found these links which resolve the same error for HttpClient:
https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/http-stack?tabs=windows
and
https://forums.xamarin.com/discussion/93419/httpclient-not-working-for-https-service
Unfortunately, it resolves the HttpClient, but not the WebClient. Changing 'SSL/TLS Implementation' in my Advanced Android Options had no effect. As well as

    WebClient client = new WebClient(new Xamarin.Android.Net.AndroidClientHandler());

gives "WebClient doesn't contain a constructor that takes 1 argument"

I'm stuck! Please, help!

Best Answer

  • atataatata ✭✭
    Accepted Answer

    I found out that there was a problem with SSL-certificate.

Answers

  • atataatata Member ✭✭
    Accepted Answer

    I found out that there was a problem with SSL-certificate.

Sign In or Register to comment.