 | |
| Wednesday, 30 July 2008 18:07 by prabian |
For reusing :
public static WebProxy BuildProxy(string proxyServer, int proxyPort, string login, string password, string commaSeparatedProxyExclusions)
{
WebProxy proxy = new WebProxy(proxyServer, proxyPort); if (!String.IsNullOrEmpty(login))
{
NetworkCredential proxyCredential = new NetworkCredential(login, password);
CredentialCache proxyCredentials = new CredentialCache();
proxyCredentials.Add(proxy.Address, "Basic", proxyCredential);
proxyCredentials.Add(proxy.Address, "Digest", proxyCredential);
proxy.Credentials = proxyCredentials;
}
foreach (string exclude in commaSeparatedProxyExclusions.Split(new char[] { ',' }))
if (!String.IsNullOrEmpty(exclude)) proxy.BypassArrayList.Add(exclude.Trim());
proxy.BypassProxyOnLocal = true;
return proxy;
}
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5