Hi, I am looking into using a proxy with the WebClient.
The code I am trying is:
When I retrieve my IP from dyndns using the MessageBox above it is showing my own IP. Some of the proxy IP's I have tested use https so I also tried the code below:
However I still get the same result.
Am I doing this wrong? Or could it be that the proxy is working but that the IP lookup websites look beyond the proxy back to the source? If so, how would I test that it is working?
Thanks
Jay
The code I am trying is:
VB.NET Code:
Using WClient As New WebClient WClient.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)") Dim WProxy As New WebProxy("<IP>:<Port>") WClient.Proxy = WProxy 'I am using this website to test the current IP MessageBox.Show(Encoding.UTF8.GetString(WClient.DownloadData("http://checkip.dyndns.org/"))) End Using
VB.NET Code:
Private Shared Function BypassCertificate(ByVal sender As Object, ByVal cert As X509Certificate, ByVal chain As X509Chain, ByVal [error] As System.Net.Security.SslPolicyErrors) As Boolean Return True End Function Private Sub TestProxy() ServicePointManager.ServerCertificateValidationCallback = New System.Net.Security.RemoteCertificateValidationCallback(AddressOf BypassCertificate) Using WClient As New WebClient WClient.Headers.Add(HttpRequestHeader.UserAgent, "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)") Dim WProxy As New WebProxy("<IP>:<Port>") WClient.Proxy = WProxy MessageBox.Show(Encoding.UTF8.GetString(WClient.DownloadData("http://checkip.dyndns.org/"))) End Using End Sub
Am I doing this wrong? Or could it be that the proxy is working but that the IP lookup websites look beyond the proxy back to the source? If so, how would I test that it is working?
Thanks
Jay