winfrom 模拟发送post数据登入百度首页,发现百度采用https协议
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("https://passport.baidu.com/?login");
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
// Send the data.
newStream.Write(data, 0, data.Length);
newStream.Close();
// Get response
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
提示 基础连接已经关闭: 接收时发生错误。应该如何解决?
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("https://passport.baidu.com/?login");
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
Stream newStream = myRequest.GetRequestStream();
// Send the data.
newStream.Write(data, 0, data.Length);
newStream.Close();
// Get response
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
提示 基础连接已经关闭: 接收时发生错误。应该如何解决?
解决方案 »
- System.Runtime.InteropServices.COMException (0x800706BF): 远程过程调用失败且未执行。
- 自己写的未完成。。。
- 基本概念问题
- 电脑的乱码是怎么出现的?(计算机的字符表里面为什么乱码)
- 请教个有关datagridview绑定dataset的问题
- 超级难题! RTF可以分栏吗?
- c/s模式下怎么来限制登录次数或只能使用一段时间???
- 打印中文的时候出现乱码,在线等待解决
- VISIO2007数据库建模后怎么导出sql文件
- win8app开发--xaml中button事件的实现,以及C#中Console的调用
- WindowsPhone7 不识别 using WindowsPhoneNavigation.Misc;
- 谢谢回答 java手机开发
public bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
return true;
}//HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("https://passport.baidu.com/?login");之前加入
ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(CheckValidationResult);