惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
腾讯CDC
T
Threatpost
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CERT Recently Published Vulnerability Notes
大猫的无限游戏
大猫的无限游戏
Apple Machine Learning Research
Apple Machine Learning Research
美团技术团队
Cisco Talos Blog
Cisco Talos Blog
C
Cisco Blogs
A
Arctic Wolf
人人都是产品经理
人人都是产品经理
NISL@THU
NISL@THU
L
LINUX DO - 热门话题
爱范儿
爱范儿
GbyAI
GbyAI
The Register - Security
The Register - Security
AWS News Blog
AWS News Blog
MyScale Blog
MyScale Blog
T
Tenable Blog
Hugging Face - Blog
Hugging Face - Blog
A
About on SuperTechFans
Cyberwarzone
Cyberwarzone
量子位
Microsoft Azure Blog
Microsoft Azure Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
C
Cybersecurity and Infrastructure Security Agency CISA
The Cloudflare Blog
B
Blog RSS Feed
小众软件
小众软件
D
Docker
Know Your Adversary
Know Your Adversary
Y
Y Combinator Blog
P
Privacy & Cybersecurity Law Blog
Engineering at Meta
Engineering at Meta
Latest news
Latest news
AI
AI
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
S
Secure Thoughts
N
News | PayPal Newsroom
The Hacker News
The Hacker News
MongoDB | Blog
MongoDB | Blog
Martin Fowler
Martin Fowler
博客园 - 司徒正美
L
Lohrmann on Cybersecurity
Cloudbric
Cloudbric

博客园 - 游游淡淡

ajaxpro在iis7.5上面客户端报未定义的另外一种情况 sql server 2008 64位连接sql 2000服务器的时候出现 MySQL忘记密码怎么修改密码 vs2015 行数统计 javascript和c#aes加密方法互解 vs2015 不能启动 iis express 修改oracle的字符集操作方法 PL/SQL Developer连接本地Oracle 11g 64位数据库 CodeSmith Generator 7.0.2激活步骤 PetaPoco利用ODP.NET Managed Driver连接Oracle html中 table 和 form的位置 android sdk镜像站点 jquery 判断checkbox是否选中几个版本的区别 sql获取汉字的拼音首字母 webservice jsonp格式调用 引用64位dll时候出现 未能加载文件或程序集“System.Data.SQLite”或它的某一个依赖项。试图加载格式不正确的程序。 SQL2008性能计数器注册表配置单元一致性失败 win8 下 IIS APPPOOL\DefaultAppPool 登录失败的解决方法 - 游游淡淡 Win8 x64环境下VS2010 C#工程运行报错:没有注册类 (异常来自 HRESULT:0x80040154
net 调用https接口
游游淡淡 · 2015-09-10 · via 博客园 - 游游淡淡

public static void ProcessRequest()
{
//类似浏览器确认证书合法方法的绑定
ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidate;

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://aaaaaa.com/getToken?");

string param = "userName=abc&type=123";
byte[] bs = Encoding.UTF8.GetBytes(param);

request.Method = "post";
using (Stream reqStram = request.GetRequestStream())
{
reqStram.Write(bs, 0, bs.Length);
}
string strResponse = "";
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
strResponse = reader.ReadToEnd();
}
}

Console.ReadKey();
}
//该方法用于验证服务器证书是否合法,当然可以直接返回true来表示验证永远通过。服务器证书具体内容在参数certificate中。可根据个人需求验证
//该方法在request.GetResponse()时触发
private static bool RemoteCertificateValidate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
{
//为了通过证书验证,总是返回true
return true;
}