httpwebrequest模拟人人网登陆POST超时的问题
static string HostUrl = "http://www.renren.com/SysHome.do";//xiaonei主页
static string LoginUrl = "http://www.renren.com/PLogin.do";//login主页
static CookieContainer cookecn = new CookieContainer();
static string email = "用户名";
static string pwd = "密码";
static string fisrtgethost = string.Empty;
static string Cookiesstr = string.Empty;
HttpWebRequest request = null;
HttpWebResponse response = null;
try
{
request = (HttpWebRequest)WebRequest.Create(LoginUrl);
request.Method = "POST";
request.Referer = "http://www.renren.com/SysHome.do";
request.ContentType = "application/x-www-form-urlencoded";
request.AllowAutoRedirect = false;
byte[] postdatabtyes = Encoding.UTF8.GetBytes(postdata);
request.ContentLength = postdatabtyes.Length;
request.CookieContainer = cookecn;
request.KeepAlive = true;
Stream requeststream = request.GetRequestStream();
requeststream.Write(postdatabtyes, 0, postdatabtyes.Length);
requeststream.Close();
response = (HttpWebResponse)request.GetResponse();
......
为什么执行到response = (HttpWebResponse)request.GetResponse();这一步就超时呢? --------------------编程问答--------------------
request = (HttpWebRequest)WebRequest.Create(LoginUrl);request.TimeOut..
request.Method = "POST";
request.Referer = "http://www.renren.com/SysHome.do";
request.ContentType = "application/x-www-form-urlencoded";
request.AllowAutoRedirect = false;
byte[] postdatabtyes = Encoding.UTF8.GetBytes(postdata);
request.ContentLength = postdatabtyes.Length;
request.CookieContainer = cookecn;
request.KeepAlive = true;
Stream requeststream = request.GetRequestStream();
requeststream.Write(postdatabtyes, 0, postdatabtyes.Length);
requeststream.Close();
--------------------编程问答--------------------
有什么区别么
补充:.NET技术 , C#