restClient访问SSL

            IRestClient client = new RestClient("https://xxx.com/aa/bb");
            var prjIds = "12067";
            var request15 = new RestRequest().AddParameter("prjIds", prjIds).AddParameter("pageLocation", 5);
            ServicePointManager.ServerCertificateValidationCallback = ((a1, b1, c1, d1) => { return true; });
            var response15 = client.Execute(request15);
            if (response15.StatusCode == HttpStatusCode.OK)
            {
                var content = response15.Content;
            }

再加上下面这句 

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | (SecurityProtocolType)3072;

 

在nuget里安装 restSharp

posted @ 2016-09-26 15:21  zslm___  阅读(1541)  评论(0编辑  收藏  举报