Setting a global HTTP proxy in C# and .NET client classes.

To configure HTTP client classes (System.Net.WebClient, System.Xml.XmlTextReader) to use an HTTP proxy use the System.Net.GlobalProxySelection class.

Example code:

System.Net.Uri proxyURI = new System.Net.Uri("http://64.202.165.130:3128");
System.Net.GlobalProxySelection.Select = new System.Net.WebProxy(proxyURI);

Subsequent invocations of methods that directly or indirectly make HTTP requests will route the request through the declared proxy.