my code works when i am not using a proxy but i want to use a proxy so that my real IP is not revealed when sending a request. Whenever i try to run my program it gives me an error saying "The remote server returned an error: (417) Expectation Failed." and it is pointing at "response = CType(request.GetResponse(), HttpWebResponse)". Is there something wrong with my code? I am really confused right now. Any help will do thanks.
Dim myProxy As New WebProxy("173.234.249.68", 8800)
Dim request As HttpWebRequest
Dim response As HttpWebResponse
Dim tempCookies As New CookieContainer
request = CType(WebRequest.Create("http://samplewebsite.com"), HttpWebRequest)
request.Proxy = myProxy
request.ContentType = "application/x-www-form-urlencoded"
request.ContentLength = POST.Length
request.KeepAlive = True
request.CookieContainer = tempCookies
response = CType(request.GetResponse(), HttpWebResponse)
tempCookies.Add(response.Cookies)
response.Close()
Best Answer
End Class