在我的应用程序中,我想检查客户端支持的安全协议。我有最新的 .Net 版本。
我的想法是将 SecurityProtocol 设置为 SecurityProtocolType Tls1.2,例如:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
我的问题是,如果客户端不支持 TLS1.2,ServicePointManager(SecurityProtocol) 是否会抛出此版本不受支持的异常?
在我的应用程序中,我想检查客户端支持的安全协议。我有最新的 .Net 版本。
我的想法是将 SecurityProtocol 设置为 SecurityProtocolType Tls1.2,例如:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
我的问题是,如果客户端不支持 TLS1.2,ServicePointManager(SecurityProtocol) 是否会抛出此版本不受支持的异常?
Yes, you should get a
NotSupportedException
In some testing I have done in the past, you would see
Unhandled Exception: System.NotSupportedException: The requested security protocol is not supported. at System.Net.ServicePointManager.set_SecurityProtocol(SecurityProtocolType value)