我目前有一个使用 .NET 3.5 框架的 Web 应用程序,我想知道它是否与 TLS 1.2 兼容。在我们的代码中,我们没有指定 TLS 版本。这是一个遗留应用程序,现在不考虑重新编译。我没有找到太多关于你是否可以的信息,但我的印象是兼容性更依赖于操作系统版本。看起来最低是 2008 R2。目标是让 Paypal 在 7 月 1 日之前正常通信。
最佳答案
如前所述,.net 3.5.1 现在支持 TLS 1.2;但您不需要@Paulina 的回答中提到的注册表更改。
我正在使用 VS 2008 和 .net 3.5.30729.4926。我所要做的就是:
添加导入:
Imports System.Security.Authentication
Imports System.Net
将此添加到我的代码 (C#) 中:
public const SslProtocols _Tls12 = (SslProtocols)0x00000C00;
public const SecurityProtocolType Tls12 = (SecurityProtocolType)_Tls12;
ServicePointManager.SecurityProtocol = Tls12
VB.net 版本:
Const _Tls12 As SslProtocols = DirectCast(&HC00, SslProtocols)
Const Tls12 As SecurityProtocolType = DirectCast(_Tls12, SecurityProtocolType)
ServicePointManager.SecurityProtocol = Tls12
选自:https://support.microsoft.com/en-us/help/3154518/support-for-tls-system-default-versions-included-in-the-.net-framework注意:通过在我的代码中定义常量,我可以忽略文章中的所有其他内容,包括注册表编辑和 cs 文件。
关于c# - .NET Framework 3.5 和 TLS 1.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43240611/