Net.ServicePointManager.SecurityProtocol .net framework 4

C#
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Source

Also in C#: