WebRequestHandler handler = new WebRequestHandler();
try
{
X509Certificate2 certificate = new X509Certificate2(System.IO.File.ReadAllBytes(ConfigurationManager.AppSettings["webapicertpath"]), ConfigurationManager.AppSettings["webapicertpwd"]); ;
handler.ClientCertificates.Add(certificate);
ServicePointManager.ServerCertificateValidationCallback =
(object sender, X509Certificate certificate1, X509Chain chain, SslPolicyErrors sslPolicyErrors) =>
{
return true;
};
}
catch
{
}
httpClient = new HttpClient(handler);

  to fetch data with REST httpclient, just utilize code below:

                case "get":
result = httpClient.GetAsync(url).Result.Content.ReadAsStringAsync().Result;
break;
case "post":
result = httpClient.PostAsync(url, content).Result.Content.ReadAsStringAsync().Result;
break;
case "put":
result = httpClient.PutAsync(url, content).Result.Content.ReadAsStringAsync().Result;
break;
case "delete":
result = httpClient.DeleteAsync(url).Result.Content.ReadAsStringAsync().Result;
break;
default:
break;

  

utilize HttpClient to generate a SSL access and generate REST access to fetch data, async programming? cool and brief的更多相关文章

  1. Configuring Squid as an accelerator/SSL offload for Outlook Web Access

    reference:http://wiki.squid-cache.org/SquidFaq/ReverseProxy/ Configuring Squid as an accelerator/SSL ...

  2. Access之C#连接Access

    原文:Access之C#连接Access 如果是个人用的小程序的话.一般都推荐用Sqlite和Access 使用SQlite数据库需要安装SQLite驱动,详情:SQLite之C#连接SQLite 同 ...

  3. Access数据库SQL注入(Access SQL Injection)

    一.Microsoft Office Access数据库手工注入语句  1.参数后面加  ’ .and 1=1.and 1=2看返回状态判断是否存在注入点 2.参数后面加 and exists(sel ...

  4. You may experience an access violation when you access an STL object through a pointer or reference in a different DLL or EXE

    Symptoms When accessing an STL object created in one DLL or EXE through a pointer or reference in a ...

  5. nginx的access的阶段的access模块、auth_basic模块、auth_request模块及satisfy指令介绍

    access 模块 示例从上向下匹配 location / { deny 192.168.1.1; allow 192.168.1.0/24; allow 10.1.1.0/16; allow 200 ...

  6. HttpClient忽略SSL证书

    今天公司项目请求一个接口地址是ip格式的,如:https://120.20.xx.xxx/xx/xx,报一个SSL的错: 由于之前请求的接口地址都是域名地址,如:https://www.xxx.com ...

  7. HttpClient SSL connection could not be established error

    系统从.net framework 升级到dotnet core2.1 原先工作正常的httpclient,会报SSL connection could not be established erro ...

  8. 你想要了解但是却羞于发问的有关SSL的一切

    Everything You Ever Wanted to Know About SSL (but Were Afraid to Ask) Or perhaps more accurately, &q ...

  9. Oracle Applications Multiple Organizations Access Control for Custom Code

    档 ID 420787.1 White Paper Oracle Applications Multiple Organizations Access Control for Custom Code ...

随机推荐

  1. SpringMVC的controller层的方法返回值

    1.ModelAndView  既带着数据,又返回视图路劲 2.String 返回试图路径  model带数据  (官方或企业推荐使用此种方式 ,此方法符合解耦思想,即数据,视图,分离 MVC) 3. ...

  2. 2_分布式计算框架MapReduce

    一.mr介绍 1.MapReduce设计理念是移动计算而不是移动数据,就是把分析计算的程序,分别拷贝一份到不同的机器上,而不是移动数据. 2.计算框架有很多,不是谁替换谁的问题,是谁更适合的问题.mr ...

  3. pandas交叉表和透视表及案例分析

    一.交叉表: 作用: 交叉表是一种用于计算分组频率的特殊透视图,对数据进行汇总 考察预测数据和正式数据的对比情况,一个作为行,一个作为列 案例: 医院预测病人病情: 真实病情如下数组(B:有病,M:没 ...

  4. 变量赋值理解--Pyton中让两个值互换的方法

    #Pyton中让两个值互换的方法 #方法一:可以理解为相当于是同时赋值 a = 5 b = 4 a,b = b,a print(a,b) #方法二:可以理解为拿箱子过程 c = 10 d = 20 e ...

  5. Python——format汇总

    一.str.format 按照指定格式格式化字符串,然后返回格式化的字符串,源字符串不变. 以下是Python2.7环境. 1.1.按照位置替换 参考下面例子: >>> s = '{ ...

  6. 【php】命名空间的影响

    命名空间对代码的影响 类(包含抽象类和traits) 接口 常量 函数 ​

  7. Altium Designer入门学习笔记1.软件安装与资料收集

    一.软件安装 微信:http://url.cn/5Eudzt9 关注微信公众号"软件安装管家",点击"软件目录",弹出"软件目录",点击进入 ...

  8. python基础之文件处理总结

    读文件: with open('contacts.txt', 'r', encoding='utf-8') as f: data = f.read() 二进制模式读 使用场景:网络传输(视频.图片或进 ...

  9. dwr介绍及配置

    DWR 编辑 DWR(Direct Web Remoting)是一个用于改善web页面与Java类交互的远程服务器端Ajax开源框架,可以帮助开发人员开发包含AJAX技术的网站.它可以允许在浏览器里的 ...

  10. Java类编译、加载、和执行

    https://www.cnblogs.com/fefjay/p/6305499.html