Skip to content

Instantly share code, notes, and snippets.

@badcommandorfilename
Created August 15, 2016 05:19
Show Gist options
  • Save badcommandorfilename/d8523a47ec07ce187761f69d325b3ce5 to your computer and use it in GitHub Desktop.
Save badcommandorfilename/d8523a47ec07ce187761f69d325b3ce5 to your computer and use it in GitHub Desktop.
.Net Core ignore ssl/X509 self-signed http request
using (var handler = new HttpClientHandler()){
handler.ServerCertificateCustomValidationCallback = delegate { return true; };
using (var httpClient = new HttpClient(handler)){
return httpClient.GetStringAsync("http://" + self.URL + "/version").Result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment