Kwull / NSpeedTest

NSpeedTest C# client library to test internet bandwidth using speedtest.net
Apache License 2.0
17 stars 36 forks source link

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

Open ThePhOeNiX810815 opened 2 years ago

ThePhOeNiX810815 commented 2 years ago

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);
        }
    }
}
eneiasramos commented 2 months ago

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