Here’s a code snippet that uses your FoxyProxy account with .NET C#.
This example connects to https://icanhazip.com through a proxy server with your proxy username and password. Be sure to replace username, password, hostname.getfoxyproxy.org and port (typically 3128 or 13129) in this example with your account information.
The C# client connects to the proxy server using HTTP and instructs the proxy server to connect to the final destination (icanhazip.com).
Although this example uses the HTTP proxy server on port 3128, other ports are available (usually 13129) with your account. HTTPS proxy server access is also available on the port 4443, which encrypts traffic between your client and FoxyProxy proxy servers. Your account also comes with SOCKS5 proxy server access, typically on port 21. You can find this information by logging into your account at the Control Panel.
public static void Main(string args)
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://icanhazip.com/");
request.PreAuthenticate = true;
CredentialCache ccache = new CredentialCache();
ccache.Add(new Uri("http://icanhazip.com/"), "Basic",
new NetworkCredential("your-username", "your-password"));
request.Credentials = ccache;
WebProxy myproxy = new WebProxy("mycoffee.getfoxyproxy.org", 13129);
myproxy.BypassProxyOnLocal = true;
request.Proxy = myproxy;
request.Method = "GET";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Encoding enc = System.Text.Encoding.GetEncoding(1252);
StreamReader loResponseStream = new
string responseString = loResponseStream.ReadToEnd();
If successful, the output is the body of https://icanhazip.com. If not successful, the error message is displayed. You may want to store username/password in the application config instead of hard-coding them.