You can instruct a WebClient
or WebRequest
object to route requests through a proxy server with a WebProxy
object:
using System;
using System.Net;
using System.IO;
using System.Linq;
using System.Text;
class Program
{
static void Main()
{
WebProxy p = new WebProxy("192.178.10.49", 808);
p.Credentials = new NetworkCredential("username", "password");
// or:
// p.Credentials = new NetworkCredential("username", "password", "domain");
WebClient wc = new WebClient();
wc.Proxy = p;
}
}
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |