Xamarin C # Error: SecureChannelFailure (Authentication or Decryption Error).

I use this:

        WebClient mClient = new WebClient();
        mClient.UseDefaultCredentials = false;
        mClient.Credentials = new NetworkCredential("Name", "Password");
        Uri mUrl = new System.Uri("https://server");
        mClient.DownloadDataAsync(mUrl);
        mClient.DownloadDataCompleted += MClient_DownloadDataCompleted;`

and I get an error in the header.

I do not understand that if I use the same code in a console application in Visual Studio, I get the expected result! But if I use this code in my Android app, I get an error in the header. I tried it on an emulator and with a device.

+4
source share
2 answers

Using ModernHttpClient did not help me. Which changed some settings in the Android project. Start by right-clicking on a project and selecting Properties.

Android Settings> Advanced> Executing HttpClient = Android

Android > > SSL/TLS = TLS 1.2 +

Visual Studio 2017.

+14

Nuget ModernHttpClient HttpClient, HttpClient = HttpClient ( NativeMessageHandler());

android = android project = > properties = > Android Option = > "" > HttpClient = > Android SSL/TLS = > Native TLS 1.2+

.

0

Source: https://habr.com/ru/post/1671933/


All Articles