Forum Xamarin.Forms

httpclient not working for https service

when i use http service it works
and when i try to use https that time httpclient always give 200 status .. please help


  • wilconwilcon USMember ✭✭✭

    Give us some more information, like code examples. You might've made a mistake somewhere.
    As far as I know HttpService works on https:// (I tried it in a test repro myself a while ago).

  • prashanthumaneprashanthumane INMember ✭✭

    Solved. HTTPS Service
    Problem for me.
    I Changed Following option from Android Build.
    1. HttpClient Implementation ->AndroidClientHandler
    2. SSL/TLS Implementation ->Native TLS 1.2+

  • OswaldoCOswaldoC Member ✭✭

    I still have the same problem, I already tested everything that was suggested, but nothing works.

    "System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: TrustFailure (One or more errors occurred.) ---> System.AggregateException: One or more errors occurred. ---> System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> Mono.Security.Interface.TlsException: CertificateUnknown

    2018-03-28 04:34:13.396 AppNivel.iOS[4830:44384] critical: 0 AppNivel.iOS 0x00000001077242e4 mono_handle_native_crash + 244
    2018-03-28 04:34:13.397 AppNivel.iOS[4830:44384] critical: 1 libsyste
    m_platform.dylib 0x0000000116778b3a _sigtramp + 26
    2018-03-28 04:34:13.397 AppNivel.iOS[4830:44384] critical: 2 ??? 0x0000000107d886d8 0x0 + 4426598104
    2018-03-28 04:34:13.397 AppNivel.iOS[4830:44384] critical: 3 libsystem_c.dylib 0x00000001163410eb abort + 127
    2018-03-28 04:34:13.397 AppNivel.iOS[4830:44384] critical: 4 AppNivel.iOS 0x00000001078f53cf xamarin_unhandled_exception_handler + 47
    2018-03-28 04:34:13.397 AppNivel.iOS[4830:44384] critical: 5 AppNivel.iOS 0x00000001077912f4 mono_invoke_unhandled_exception_hook + 148
    2018-03-28 04:34:13.398 AppNivel.iOS[4830:44384] critical: 6 AppNivel.iOS 0x0000000107723e17 mono_handle_exception_internal + 5623
    2018-03-28 04:34:13.398 AppNivel.iOS[4830:44384] critical: 7 AppNivel.iOS 0x0000000107722819 mono_handle_exception + 25
    2018-03-28 04:34:13.398 AppNivel.iOS[4830:44384] critical: 8 AppNiv"

    Any idea ?

  • asmykasmyk Member ✭✭

    @OswaldoC Did you get it fixed? I have the same problem

  • FredyWengerFredyWenger CHInsider ✭✭✭✭✭

    I don't know, what the problem was, but I also had some problems, as I have started with my first https webservices.
    The reason was, that I have started with a self signed certificate, what does not work without ugly workarounds...
    So.. only use signed (trusted) certificates from a public vendor and you should not have any problem...
    To switch between http and https you only have to change the url (from http to https) - no further changes in the app ae needed.
    I normally do first (local) tests with the web service with http (the url ist loaded from an .ini file) and then copy the web service to the "real" webserver (with certificate and https url).
    I never had any problems (when a trusted certificate is used)...

  • vinothswamivinothswami Member ✭✭✭

    I have also the same problem...(a call to sspi failed xamarin) when I use https, in Visual studio 2015 it's working but the same code it's not giving up the result as I expected...

    I have changed the settings in vs 2017 as...
    1. open ->property
    2. Android option -> Additional supported encodings
    3. change the HTTP client implementation -> Android from default.

    that's it... now it's working as I expected

  • atataatata Member ✭✭
    edited February 12

    Does anybody know where to find that option in VS 2019?
    Thanks in advance!

  • NMackayNMackay GBInsider, University mod

    Android project properties -> Android Options and click on Advanced button

  • atataatata Member ✭✭
    edited February 12

    I'm sorry - one of the bottom panels covered the button!
    Thank you so much!

Sign In or Register to comment.