Using TLS 1.2 in the .NET Framework 2.0

2

I want to use TLS 1.2 on a Webclient call in the framework .NET 2.0

Is it possible?

try
{
    using (System.Net.WebClient client = new System.Net.WebClient())
    {
        string u = client.UploadString(url, xml);
        return u;
    }
}
catch (Exception ex)
{
    throw ex;
}
    
asked by anonymous 04.12.2017 / 18:51

1 answer

1

It is not possible, at least directly, only in 4.5 upwards. .NET 2.0 is no longer supported and should not be used, it does not receive security updates.

Maybe you can get source and adapt to if used (but not trivial).

Enjoy and improve the code:

using (var client = new WebClient()) {
    return client.UploadString(url, xml);
}

Much simpler, right? Capturing the exception is only causing problems for the code. Only take exception to do something useful. What you're doing is just spoiling the stack trace .

    
04.12.2017 / 19:17