日期:2014-05-17  浏览次数:21014 次

GetResponse()无法连接到远程服务器

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                request.Accept = "*/*";
                request.Headers.Add("Accept-Language", "zh-cn");
                //request.Referer = url;
                request.Referer = "http://www.xn--7iqg6qy26e.com/member/login.php?part=register";
                //request.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)";
                request.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.3; .NET4.0C; .NET CLR 2.0.50727; .NET4.0E; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)";
                request.KeepAlive = true;
                request.AllowAutoRedirect = false;
                request.Headers.Add("Cache-Control", "no-cache");
                request.Headers.Add("UA-CPU", "x86");
                request.ServicePoint.Expect100Continue = false;
                request.Timeout = 100000;
                request.Method = "GET";
                request.CookieContainer = new CookieContainer();
                WebResponse response = request.GetResponse();//这行报错,无法连接到远程服务器,请各位高手帮忙看看这是怎么回事儿?
无法连接到远程服务器