GetWebProxy


public static WebProxy GetWebProxy()
{

WebProxy myProxy = new WebProxy();
string proxyAddress = "http://proxy.example.net:8080/";
string username = "myName";
string password = "myPassword";

// Create a new Uri object.
Uri newUri = new Uri(proxyAddress);

// Associate the newUri object to 'myProxy' object so that new myProxy settings can be set.
myProxy.Address = newUri;

// Create a NetworkCredential object and associate it with the 
// Proxy property of request object.
myProxy.Credentials = new NetworkCredential(username, password);
return myProxy;
}

No comments:

Post a Comment