Quantcast
Channel: Questions in topic: "httpwebrequest"
Viewing all articles
Browse latest Browse all 190

Unity returns NULL when I try to send a HTTPS request

$
0
0
I'm struggling to send a HTTPS request on Unity for about 3 days. I did search a lot about it and what I understand is that Mono doesn't support SSL validation. There is a solution for this on the internet. Putting this snippet code in above of HTTP request code. ServicePointManager.ServerCertificateValidationCallback += (o, certificate, chain, errors) => true;
But, unfortunately, it's not working.

I'm using the "Http Client" asset: https://www.assetstore.unity3d.com/#!/content/79343

My code: public string send() { HttpClient httpClient = new HttpClient(); ServicePointManager.ServerCertificateValidationCallback += (o, certificate, chain, errors) => true; httpClient.GetString(new Uri("https://jsonplaceholder.typicode.com/todos/1"), (r) => { Debug.Log(r.Data); }); }
I would be glad If someone can help me on this. I've tried the official HTTP APIs of Unity but the result is same. Please don't suggest me to upgrade the runtime or Unity version. I'm making a Unity asset for [botdelive][1] and it should work on every version of it. By the way, I don't want to use StartCoroutine/IEnumerator.

**Unity version: 2017.3.1.f1
Runtime version: .NET 3.5
Api Compatibilitiy Level: .NET 2.0 Subset** [1]: https://botdelive.com/

Viewing all articles
Browse latest Browse all 190

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>