I'm trying to add the following line of code to the Global.asax file in a website project.
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
The vs2012 IntelliSense is showing that Tls12 definition exist. But the build is saying that the definition does not exist (See screen shot).
I've tried adding System.Net.dll to the bin folder of the project, but the build still failed. Any idea how I might be able to resolve this?
Definition. Specifies the security protocols that are supported by the Schannel security package. This enumeration supports a bitwise combination of its member values.
ServicePointManager is a static class used to create, maintain, and delete instances of the ServicePoint class.
SecurityProtocolType.Tls11 and SecurityProtocolType.Tls12 enum values are missing on Framework 4.0 only.
SecurityProtocolType numeric values:
SystemDefault (0)
Ssl3 (48 - 0x30)
Tls (192 - 0xC0)
Tls11 (768 - 0x300) missing on Framework 4.0
Tls12 (3072 - 0xC00) missing on Framework 4.0
On Framework 4.0, if want to allow TLS 1.0, 1.1 and 1.2, just replace:
SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12
by:
(SecurityProtocolType)(0xc0 | 0x300 | 0xc00)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With