System.Net.Http.HttpClient in C# wont work on HTTPS

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By PoisnFang

I am really struggling here to get the C# Httpclient to accept a https address. I keep throwign an erorr about Tls, and I have looked around but I have no idea how to get it to work.

I have made a sample repo for what I am trying to do.
It is a pretty simple concept, the logic is in Lobby.cs when you press the host button I want it to call the pokeapi and print the info the console. When you run it though it will throw an error about Tls and I do not know how to fix it. I realize that it has to do with CORS and I need a SSL cert in order to request info from an HTTPS source, but I dont know how to actually implement that…

private async void GetDitto()
    HttpClient client = new HttpClient();
    var response = await client.GetAsync("");
    var pokemon = await response.Content.ReadAsStringAsync();

I also realize that I CAN use the built in HHTPClient that Godot has in order to get THIS scenario to work, however for my future implementations it will NOT.

:bust_in_silhouette: Reply From: yrtv

You did not forget about Same-origin policy?


Cert store bundled with godot’s mono is outdated. Your only option is recompile with updated certificates.

While I appreciate what you are trying to ask, I have updated my question.

PoisnFang | 2021-02-17 20:53