✅ Request error: The SSL connection could not be established, see inner exception.
I am using a mail sender API which is working in other language scripts and postman but not in C#. and giving the above mentioned error
15 Replies
Show us the exception + inner exceptions... Most likely the server's SSL certificate is not trusted on your machine
How do i make it to trust
Interop+AppleCrypto+SslException: bad protocol version
are you expected to use TLS v1.3? AFAIK it is not supported on macOS
idk, it works on postman (cURL) and other language scirpts
is there some way to bypass this?
you can try this
new HttpClient(new SocketsHttpHandler() { SslOptions = { EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12 } });
Migrate from HttpWebRequest - .NET
Learn how to migrate from HttpWebRequest to HttpClient.
Unknown User•2w ago
Message Not Public
Sign In & Join Server To View
I'm not sure this would help with the posted error... that is why I posted the link to migration FROM web request as it shows how to use the SocketsHttpHandler... not saying anybody should use http web request in modern .net
Unknown User•2w ago
Message Not Public
Sign In & Join Server To View
yeah but the link shows how to use the sockets handler 😄
Unknown User•2w ago
Message Not Public
Sign In & Join Server To View
I had no clue you can change the TLS version like this
Unknown User•2w ago
Message Not Public
Sign In & Join Server To View
If I knew you can change it in project settings I would say that lol
Unknown User•7d ago
Message Not Public
Sign In & Join Server To View