Can we add four protocols to ServicePointManager.SecurityProtocol?

2.2k Views Asked by At

I want to support all security protocols from ssl3 to tls 1.2 . But while searching on net I either found code as

`ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11;`

or as

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

But, I want to support all the protocols. So, is it wrong to write as

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;

I didn't give me any compilation errors when I wrote the above code.So, will this cause any problem?

1

There are 1 best solutions below

2
On BEST ANSWER

Yes it will work. You can find a web site which only supports TLS 1.2 and try different combinations of this value, when you omit SecurityProtocolType.Tls12 from your value, your .NET app won't be able to connect to that site.