Search code examples
c#httpclientazure-maps

supporting TLS 1.2 in HttpClient C#


Good afternoon! I use Azure Maps API using HttpClient. How can I enable support of TLS 1.2? As I know in Framework 4.6+ it is supported. And I should not do anything for this to work?


Solution

  • In general you do not need to specify any configuration in your application to enable adoption of the latest TLS protocol.

    Best practices and scenarios are outlined on learn.microsoft.com for earlier than .Net 4.7.

    At high level, you should make audit to make sure your application doesn't take any hard dependency on a lower TLS version. But otherwise no work should be required.

    We recommend that you:

    • Target .NET Framework 4.7 or later versions on your apps. Target .NET Framework 4.7.1 or later versions on your WCF apps.
    • Do not specify the TLS version. Configure your code to let the OS decide on the TLS version.
    • Perform a thorough code audit to verify you're not specifying a TLS or SSL version.

    When your app lets the OS choose the TLS version:

    • It automatically takes advantage of new protocols added in the future, such as TLS 1.3.
    • The OS blocks protocols that are discovered not to be secure.