Force TLS for REST requests

I needed to perform REST requests. The endpoint was an SSL secured site. When I issued the request using RestSharp I kept getting the following error:

Could not create SSL/TLS secure channel

It turned out that you have to force the framework to actually use TLS. I used this line to do so:

Please note that AFAIK this requires at least .NET 4.5

Leave a Reply

Your email address will not be published. Required fields are marked *