string urlStr = "http://www.itstrike.cn"; //设定要获取的地址
HttpWebRequest hwr = (HttpWebRequest)HttpWebRequest.Create(urlStr); //建立HttpWebRequest对象
hwr.Timeout = 60000; //定义服务器超时时间
WebProxy proxy = new WebProxy(); //定义一个网关对象
proxy.Address = new Uri("http://proxy.domain.com:3128"); //网关服务器端口:端口
proxy.Credentials = new NetworkCredential("f3210316", "6978233"); //用戶名,密码
hwr.UseDefaultCredentials = true; //启用网关认证
hwr.Proxy = proxy; //设置网关