SecurityProtocolTypeExtensions.Tls12; does not exist in current context

こ雲淡風輕ζ 提交于 2019-12-01 07:17:16

The fix is stated in the article you linked to:

To include the support for TLS v1.2, include the source files in your project...

In other words - you need to add the SecurityProtocolTypeExtensions and SslProtocolExtensions types from the article to your own project.

It's a bit of an ugly hack, but is required because TLS 1.2 was released after .NET 3.5.

Alternatively if you want to avoid using these extensions and don't mind unlabelled magic numbers in your code, you could ignore the code in the article and just set this instead:

System.Net.ServicePointManager.SecurityProtocol = (SecurityProtocolType)0x00000C00;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!