Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we add four protocols to ServicePointManager.SecurityProtocol?

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?

like image 366
V K Avatar asked Jan 31 '26 06:01

V K


1 Answers

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.

like image 180
huseyint Avatar answered Feb 02 '26 19:02

huseyint



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!