- Home /
HttpWebRequest to https on Android?
What I'm doing is beyond the capability of WWW.
Sending an HttpWebRequest to an https URL works fine on iOS but on Android I get:
System.Net.WebException: Error getting response stream (Write: The authentication or decryption has failed.)
I can get past this error if I return true from a RemoteCertificateValidationCallback, but this is basically ignoring security, which doesn't seem like the right thing to do. I tried UniWeb and it just returns true too, it doesn't check anything.
Looking further into RemoteCertificateValidationCallback, it reports a PartialChain error, probably because it can't find any certificates to validate the one that it received on the server. Opening the X509Stores, there are 0 certificates under Current User and Local Machine.
What do you do to talk to web services over http on Android?
@Curyous: I know this is a really old thread, but I'm running into exactly this issue and searching answers yields almost exclusively WebPlayer target crossdomain policy issues. Like you, I'm targeting Android. Were you able to solve your problem?
@DimensionU I solved it in the end by creating my own native plugin because you can do anything you want natively. If I was trying to solve that problem now I'd probably buy a cross-platform http solution from the Asset Store.
Answer by DimensionU · Aug 18, 2015 at 06:31 PM
Thanks, @Curyous! I've been using UniWeb, which is cross platform, but doesn't seem to be getting along with GET requests with custom headers used for authentication on Android (works fine on iOS, Mac, Windows and WebPlayer). I conditionally compiled so that if I'm on Android, I just use the WWW class and use UniWeb for other targets.
@DimensionU Ah, that's probably why I wrote my own. I think there's another one called "Best Http" you could try, but I can't confirm that it works properly on Android.
Your answer
Follow this Question
Related Questions
WWW and SSL on Android 1 Answer
WWW with HTTPS on Android not working 0 Answers
Send POST request to HTTPS 1 Answer