I am using
WebClient to get data from a web resource thus:
var wc = new System.Net.WebClient(); var stream = wc.OpenRead("http://..."); // etc..
It used to work until recently, when the server would forcibly close the connection.
Based on this StackOverflow answer, I added the
ServicePointManager setting thus:
var wc = new System.Net.WebClient(); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var stream = wc.OpenRead("http://..."); // etc..
… and it once again works as it did before.
I get that TLS is relevant to HTTPS and the effect of the setting is to include TLS1.2 in the handshake, and that the host site must have been recently updated to reject the older vulnerable protocol, but why is it necessary for ordinary, non-secure HTTP?