0

We have 2 tracks

Adding TLS 1.2 support to .Net 4.6.1 application

As of now we have added below line of code wherever we're making REST API calls

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;

But as per this article we just need to implement AppContextSwitchOverrides concept in web.config. With this change

  1. Can I remove ServicePointManager.SecurityProtocol code line from everywhere in application since with AppContextSwitchOverrides change .Net application will pick up OS level TLS supported version
  2. With AppContextSwitchOverrides change Do I need to verify with Infra team whether they have added TLS1.2 OS level support( Window 2012 R2 ). If not , I'll not remove ServicePointManager.SecurityProtocol line of code
  3. Instead of doing all above change Can I simply change targetFramework from 4.6.1 to 4.6.2 in application which is by default supporting TLS 1.2. Do you think any complication on this .Net version change?

Adding TLS 1.2 support to .Net 4.5.1 application

Do we need to follow the steps as mentioned in this article OR Use AppContextSwitchOverrides concept for this version

Sukhjeevan
  • 3,074
  • 9
  • 46
  • 89
  • Sounds complicated why don't you just upgrade to .Net 4.7+ [as Microsoft recommends](https://learn.microsoft.com/en-us/dotnet/framework/network-programming/tls). You may want to review any [breaking changes](https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/runtime/4.5-4.8), there are not usually anything to worry about when it's the same major version number, most are bug fixes – Charlieface Mar 07 '21 at 01:25
  • Because we don't know how app will behave on PROD after 4.8 upgrade and don't have much time to fix any issue if occur on UAT due to dependency so thinking if we can go with AppContextSwitchOverrides concept. [This article](https://stackoverflow.com/questions/59306059/how-to-upgrade-all-solution-projects-net-framework-4-5-1-to-4-8-visual-studio-2) describe how to upgrade framework by changing .csproj and package.config file but what about upgrading other dlls – Sukhjeevan Mar 07 '21 at 04:30
  • Other dlls will use the version that was loaded by the exe, so long as the major version is the same (4.x). There are not many issues that can occur, because nearly every change is non-breaking: either fixing a bug that shouldn't have existed, adding a function or function overload, or perhaps more specific error messages. Unlees you are doing silly things with reflection, you shouldn't have much issue. – Charlieface Mar 07 '21 at 04:36
  • Don't we need to update all assemblies version is in `...` and `...` and dlls version as per target version ? How about using `https://marketplace.visualstudio.com/items?itemName=PavelSamokha.TargetFrameworkMigrator` for version upgrade? – Sukhjeevan Mar 07 '21 at 05:01
  • Sorry I thought you meant pre-compiled dlls. Yeah you should change the target framework on all the projects. But that doesn't take long. I have no experience of that extension – Charlieface Mar 07 '21 at 10:10
  • targetframework change in .csproj and package.config file won't take much time but how to make sure all other dlls( System.Web.Mvc,WebPages,Http etc.) version is as per new targetframework (4.8) ? – Sukhjeevan Mar 07 '21 at 22:51
  • They should just work with whichever version of the framework is previously loaded, so long as it's the same major version number, 4.x – Charlieface Mar 08 '21 at 00:20

0 Answers0