![]() |
|
[.NET] VB.NET WebClient Proxy Issue... - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] VB.NET WebClient Proxy Issue... (/showthread.php?tid=5781086) |
VB.NET WebClient Proxy Issue... - TeachMe1 - Jan 7, 2018 I have been working on a small application that can crawl Google to show some of the search engine results pages and the WebClient normally connects fine, but after trying to connect to Google thru the WebClient proxy property, it just isn't connecting properly. Here is the code that I'm working with: Code Try I know that I have found proxies that should work with Google as I've clearly tested them in my Google Chrome browser to see if they're dead or alive, but when I try to connect in my own application through the WebClient proxy setup, I keep getting the following error messages: "Unable to connect to the remote server" OR "(503) Server Unavailable" What am I missing? Could it be the headers are not fully configured or some other properties? Would appreciate any ideas. RE: VB.NET WebClient Proxy Issue... - Soldiercrimes - Jan 7, 2018 Why do you set useragent as a header? Code wc.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"and about the proxies: Code Dim Proxies As New Queue(Of String)(File.ReadAllLines(directory))RE: VB.NET WebClient Proxy Issue... - Ninja - Jan 7, 2018 (Jan 7, 2018 11:08 AM)Soldiercrimes Wrote: Why do you set useragent as a header? No. Don't declare a new random instance just for getting a random integer. Declare the random once outside of the method, or as a constant inside the method, and then reference that. Also, validate the input. Read the text file line by line, check if they are valid proxies, then enqueue them to the queue. Also, your answer does not answer his question. @OP are you sure the proxies are HTTP and that you use the exact same proxy in your program as in your browser? If you are trying to use socks proxies you are out of luck as .NET framework has no support for socks proxies on it's own. RE: VB.NET WebClient Proxy Issue... - Sn0wX - Jan 7, 2018 "user-agent" is a header. The webclient class has no direct "user-agent" property. It would of taken you a matter of minutes to check this before correcting a member's correct code to something not even provided. Remember the webclient class is only a wrapper. For more flexibility, useother classes made ready for you. Ninja: As i know you know the web client interface uses Internet explorers settings. At a guess, i would say, even when specifying a proxy the property would still be needed to be overridden. My guess without looking, BypassProxyOnLocal needs to be set to true. Maybe, maybe not. Have no intention looking. I am sure you would have done more research if your own project. But why do others work? :) |