none
How to make webclient connect thouhg socks5 proxies? RRS feed

  • Question

  • So as the title says I want my webclient to connect with socks5 proxies

    WebProxy wp = new WebProxy(socks5 proxy);
    client1.Proxy = wp;
    client1.DownloadString("someurl")

    Wednesday, January 23, 2019 4:35 PM

All replies

  • Hi BataBo Jokviu,

    Thank you for posting here.

    For your question, you could try the code below.

    //NameSpace: System.Net
    using ( WebClient wc = new WebClient () )
    {
      WebProxy wp = new WebProxy ( "Proxy server IP address: proxy server port" ), true );
    
      if (/*Proxy server does not authenticate*/)
      {
        wp.Credentials = CredentialCache.DefaultCredentials;
      }
      else
      {
        wp.Credentials = new NetworkCredential("UserName", "PassWord");
      }
    
      wc.Proxy = wp; //Designated agent
      wc.Encoding = System.Text.Encoding.Default;
      //wc.DownloadString(....)
      //wc.OpenWrite()
    }

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, January 24, 2019 6:25 AM
    Moderator