zoukankan      html  css  js  c++  java
  • Web Server 使用WebClient 发送https请求 The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel

    使用WebClient 发送https请求

    使用WebClient发送请求时,并且是以https协议;

    WebClient webClient = new WebClient();

    string result = webClient.DownloadString(url);

    error : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel

    只需一行代码:

    ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };//获取或设置用于验证服务器证书的回调。[SSL]

    每个问题都有解决之法,遇到问题不要怕,解决问题才是提升最快的。

    --------------------------------送给每天和bug打交道的博友们

  • 相关阅读:
    Red and Black POJ
    Catch That Cow HDU
    Lotus and Horticulture HDU
    进击的绿色
    北京办护照
    女码农真诚征gg
    bitset
    long long
    cnblogs latex公式
    2050 Programming Competition (CCPC)
  • 原文地址:https://www.cnblogs.com/zlp520/p/4447689.html
Copyright © 2011-2022 走看看