Good day! I would like to check on the site counter visitors. I have several proxies and I wanted to make a small program to enter the site, under different proxies.

public void Webrequest(string url, string proxy) { try { var request = WebRequest.Create(url); WebProxy proxyObject = new WebProxy(proxy, true); proxyObject.BypassProxyOnLocal = false; request.Proxy = proxyObject; } catch(Exception e) { MessageBox.Show(e.ToString()); } } 

But it does not work, it still uses my IP address when requesting it.

    1 answer 1

    Pay attention to this miracle https://github.com/X-rus/xNet . For you just right. Example request with proxy:

     HttpRequest request = new HttpRequest(); request.UserAgent = Http.ChromeUserAgent(); request.Proxy = HttpProxyClient.Parse("127.0.0.1:1080"); string responce = request.Get("http://site.com/").ToString(); request.Close(); 

    However, if you still need standard tools, then, for example, like this:

     public void Webrequest(string url, string proxy) { try { var request = WebRequest.Create(url); request.Proxy = new System.Net.WebProxy { Address = new Uri("http://127.0.0.1:8080") }; //тут логика работы с http... } catch(Exception e) { MessageBox.Show(e.ToString()); } } 

    Please note that there are also proxies with a password or Socks. Good luck!