我想知道如果其中一个powershell,C#专家可以在Windows上使用[System.Net.WebRequest]在webrequest期间如何强制使用Sslv3
我想将以下C#代码转换为Powershell的等价代码:
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
Run Code Online (Sandbox Code Playgroud)
我尝试将以下代码添加到我的脚本,但得到并且错误,术语"Net.SecurityProtocolType.ssl3"未被识别为cmdlet,脚本文件,函数的名称.以下是我在代码中使用的内容:
[System.Net.ServicePointManager]::SecurityProtocol = Net.SecurityProtocolType.ssl3
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助!
枚举需要扩展类型方括号语法:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::ssl3
Run Code Online (Sandbox Code Playgroud)
您也可以让PowerShell为您投射:
[Net.ServicePointManager]::SecurityProtocol = 'ssl3'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5104 次 |
| 最近记录: |