C# WebClient 使用http免费代理

static void Main(string[] args)
        {
            WebClient client = new WebClient();
            client.Encoding = Encoding.GetEncoding("gb2312");
            if (true)
            {
                WebProxy proxy = new WebProxy();
                proxy.UseDefaultCredentials = false;
                proxy.Address = new Uri("http://183.239.167.122:8080"); // new Uri("http://183.239.167.122:8080");
                client.Proxy = proxy;
            }
 
            string result = client.DownloadString("http://1212.ip138.com/ic.asp");
            Console.WriteLine(result);
 
            Console.WriteLine();
            Console.WriteLine("OVER");
            Console.ReadLine();
        }

 

posted @ 2017-08-01 15:03  俺老刘  阅读(524)  评论(0编辑  收藏  举报