NSpeedTest icon indicating copy to clipboard operation
NSpeedTest copied to clipboard

WebClient.DownloadString() ->> GetConfig() is returning 403

Open ThePhOeNiX810815 opened this issue 3 years ago • 1 comments

I have changed code and it's working fine, TLS issue.

public T GetConfig<T>(string url)
{
	using (WebClient webClient = new WebClient())
	{
		ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

		var data = webClient.DownloadString(url);
		var xmlSerializer = new XmlSerializer(typeof(T));
		using (var reader = new StringReader(data))
		{
			return (T)xmlSerializer.Deserialize(reader);
		}
	}
}

ThePhOeNiX810815 avatar Sep 19 '22 18:09 ThePhOeNiX810815

@ThePhOeNiX810815 https://github.com/Kwull/NSpeedTest/pull/9

eneiasramos avatar Aug 20 '24 22:08 eneiasramos