• WebRequest 访问 https


    参考代码:

       1:         [TestMethod]
       2:          public void TestHttps()
       3:          {
       4:              var req =(HttpWebRequest) System.Net.WebRequest.Create("https://www.baidu.com/");
       5:              ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
       6:              var rep =(HttpWebResponse) req.GetResponse();
       7:              var stream = rep.GetResponseStream();
       8:              StreamReader reader = new StreamReader(stream);
       9:              string content = reader.ReadToEnd();
      10:              reader.Close();
      11:              stream.Close();
      12:          }

    关键代码:ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

  • 相关阅读:
    INS-30011 输入的ADMIN口令不符合Oracle建议的标准
    INS-30001 ADMIN口令为空
    INS-20802
    ORA-00922:选项缺失或无效
    struts2的配置文件
    Cache Fusion
    MQ配置模板
    RTSP流媒体数据传输的两种方式(TCP和UDP)
    ArcGIS For Flex报错二
    ArcGIS For Flex报错
  • 原文地址:https://www.cnblogs.com/leleroyn/p/4603522.html
Copyright © 2020-2023  润新知