According to .net guidance of TLS protocol programming, it suggests to config security via appcontext switch when your project targets on .net 4.6. This way works when add appcontext in app.config for console application. However, it doesn't work when add appconext switch in web.config for website project.
This is the config I add.
<runtime>
<AppContextSwitchOverrides value="Switch.System.Net.DontEnableSchUseStrongCrypto=false;Switch.System.Net.DontEnableSystemDefaultTlsVersions=false"/>
</runtime>
Create a new separate project in asp.net higher version. Add new Web Service or WebAPI(Later we will consume it in the main project). Write down a particular code here and call particular API which needs to validate with TLS 1.2. Now Deploy this web service/WebAPI and consume in the main project.
Click the Windows button on the lower left-hand corner of your Desktop. Type "Internet Options" and select Internet Options from the list. Click on the Advanced tab and from there scroll down to the very bottom. Confirm that TLS 1.2 is checked.
By default, . NET Framework 4.7 and later versions is configured to use TLS 1.2 and allows connections using TLS 1.1 or TLS 1.0.
AppContext switches usage in web config file:
<appSettings>
<add key="AppContext.SetSwitch:Switch.System.Net.DontEnableSchUseStrongCrypto" value="false" />
<add key="AppContext.SetSwitch:Switch.System.Net.DontEnableSystemDefaultTlsVersions" value="false" />
</appSettings>
https://github.com/dotnet/docs/issues/6675
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With