When using code in ASP.NET to connect to a remote https server such as PayPal, .NET versions older than 4.6 will not automatically
use the newer TLS protocols.
To enable support, the following code needs to be added to the web site, preferably somewhere in the startup code (such as in global.asax):
VB.NET
System.Net.ServicePointManager.SecurityProtocol = 3840
C#
System.Net.ServicePointManager.SecurityProtocol = (System.Net.SecurityProtocolType)3840;
This code will enable only TLS 1.1 and 1.2 for all outbound connections. TLS 1.0 and older SSL versions will be disabled.