VB.NET WebClient Proxy Issue...
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: VB.NET WebClient Proxy Issue...

  1. #1
    Join Date
    Dec 2016
    Posts
    8

    Lightbulb VB.NET WebClient Proxy Issue...

    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
                Dim wc As New System.Net.WebClient()
               'This line below will bring in the "User Agent" to make the HTTP request:
                wc.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36")               
                Dim wp As New System.Net.WebProxy(TextBox1.Text)
                wc.Proxy = wp
                Dim HTML As String = wc.DownloadString("https://www.google.com/search?q=dog+training")
    
    
            Catch ex As Exception
                MsgBox(ex.Message)
    End 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.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,602

    Re: VB.NET WebClient Proxy Issue...

    What does the variable 'TextBox1.Text' contain? Have you verified it is what you think it is?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)