Theme:
Ignore SSL issue or wrong certificate
How can I ignore the SSL issue or my certificate? For some reason my SSL it's not working and the Android app is returning SSL issue and crash.
Answers
Follow the code about the client to ignore.
var handler = new HttpClientHandler(); handler.ClientCertificateOptions = ClientCertificateOption.Manual; handler.ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) => { return true; }; _client = new HttpClient(handler);
Tuesday, January 31, 2023
Mauricio Junior
var handler = new HttpClientHandler();
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
handler.ServerCertificateCustomValidationCallback = (httpRequestMessage, cert, cetChain, policyErrors) => { return true; };
_client = new HttpClient(handler);
Wednesday, February 1, 2023
Mauricio Junior
Ignoring SSL issue on HTTPs web site.
` private HttpClient GetClient() { if (_client == null) { // do not set timeout for iOS since it doesn't appear to adress the actual issue // instead add handler for compression for all device types var handler = new HttpClientHandler(); handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
//ignore the SSL issue (invalid certificate)
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
handler.ServerCertificateCustomValidationCallback =
(httpRequestMessage, cert, cetChain, policyErrors) =>
{
return true;
};
_client = new HttpClient(handler);
_client.DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
_client.Timeout = TimeSpan.FromSeconds(200); // 100 is the default
}
return _client;
}
`
Espero que tenha ajudado.
Wednesday, February 1, 2023
Mauricio Junior
We have here an SSL course in Portuguese
https://ecode10.academy/curso/24/ssl-e-https
The course teaches you how to create and publish the SSL in your website.
Monday, February 6, 2023
Mauricio Junior