【问题标题】:server not responding to WebClient using TLS 1.2服务器未使用 TLS 1.2 响应 WebClient
【发布时间】:2018-08-14 15:04:37
【问题描述】:

虽然我专门使用 TLS 1.2,但服务器仍然拒绝连接。

我的代码在这里:https://dotnetfiddle.net/zcVum2

错误:远程服务器返回错误:(403) Forbidden。

using (WebClient wc = new WebClient())
            {
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            string url = "https://www.converse.com";
            wc.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.BypassCache);
            wc.Headers.Add("Cache-Control", "no-cache");
            wc.Encoding = Encoding.UTF8;
            string result = wc.DownloadString(url);
        }

【问题讨论】:

    标签: c# webclient tls1.2


    【解决方案1】:

    我可以通过更改为 .net core 来解决问题,即使不需要 SSL 配置

    【讨论】:

      猜你喜欢
      • 2022-08-23
      • 1970-01-01
      • 2021-06-25
      • 2018-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-23
      • 2020-04-05
      相关资源
      最近更新 更多