ServicePointManager.DefaultConnectionLimit = 500;
ServicePointManager.Expect100Continue = true;
ServicePointManager.CheckCertificateRevocationList = false;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
string url = @"https://login.wx2.qq.com/jslogin?appid=wx782c26e4c19acffb";
HttpWebRequest wRequest = (HttpWebRequest)WebRequest.Create(url);
wRequest.Method = "GET";
wRequest.ContentType = "text/javascript";
wRequest.CookieContainer = CookiesContainer; //启用cookie
if (CookiesContainer == null)
{
CookiesContainer = new CookieContainer();
}
WebResponse wResponse = wRequest.GetResponse();
Stream stream = wResponse.GetResponseStream();
StreamReader reader = new StreamReader(stream, System.Text.Encoding.Default);
string str = reader.ReadToEnd(); //url返回的值
MessageBox.Show(str);
reader.Close();
wResponse.Close();
上面代码为什么在部分电脑上超时,手动打开网页没问题,求思路!