1

When I use HTTP request everything works fine

public async static Task<PersonUser> getDataBase()
        {
           
            string url = $"http://my.access.point/api/rtr/Person/CheckIAmUser";

            //https://github.com/EgorBo/NtlmHttpHandler
            var handler = NtlmHttpHandlerFactory.Create();
  
            handler.Credentials = new NetworkCredential("login", "password", "domain"); 
            
            var httpClient = new HttpClient(handler);

            var response = await httpClient.GetAsync(url);
            if (response.StatusCode == HttpStatusCode.OK)
            {
                var json = await response.Content.ReadAsStringAsync();
                var dbu = JsonConvert.DeserializeObject<PersonUser>(json);
                return dbu;
            }

            return null;
        }

But when I use HTTPS

string url = $"https://my.access.point/api/rtr/Person/CheckIAmUser";

I get this error

InnerException {System.Net.WebException: Error: TrustFailure (Authentication failed, see inner exception.) ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routine…} System.Net.WebException

Screenshot of error

VisualStudio for Mac (community) v 8.9.6

Test project on github is here https://github.com/emakhankov/ProblemNtlmHttpsXamarin

My Settings of httphandler and tls

  • does your server have a valid SSL cert? – Jason Apr 18 '21 at 19:00
  • Yes I can open this page via browser. And another code for IOS (written by swift) works fine with this url via https – Evgeny Makhankov Apr 18 '21 at 19:59
  • @EvgenyMakhankov change HttpClient implementation to Android, SSL/TLS implementation to Native TLS1.2+, take a look [HttpClient Stack and SSL/TLS Implementation Selector for Android](https://learn.microsoft.com/en-us/xamarin/android/app-fundamentals/http-stack?tabs=windows) – Cherry Bu - MSFT Apr 19 '21 at 06:16
  • @CherryBu-MSFT My settings are the same – Evgeny Makhankov Apr 19 '21 at 07:13
  • @EvgenyMakhankov try to bypass the certificate by extend the [AndroidClientHandler](https://stackoverflow.com/questions/48951913/xamarin-android-adding-client-certificate) – Cherry Bu - MSFT Apr 23 '21 at 09:04

0 Answers0