In c# I am able to set a static value for SSL3 or TLS, e.g.
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
Or:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
But (I believe) this will affect all future HttpWebRequest objects in my application.
Is there a way to set this for a given HttpWebRequest or at least for a given URI?
Note I have seen this:
Uri uri = new Uri(url);
ServicePoint sp = ServicePointManager.FindServicePoint(uri);
But ServicePoint does not have a SecurityProtocol property.
At present I am thinking I will have to just set the static global property prior to creating a new HttpWebRequest.
This doesn't feel right and it also means:
Realised this has been covered here:
How to use SSL3 instead of TLS in a particular HttpWebRequest?
And here:
Set the SecurityProtocol (Ssl3 or TLS) on the .net HttpWebRequest per request
Confirming my fears. Some users appear to be spinning up a separate app domain to work around this. I still think it might be possible with some thread locking if it was well defined at what point the setting is bound to a particular web request object.
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