none
how to set proxy in httpwebrequest listbox1.items vb.net RRS feed

  • Question

    • Welcome everyone
    • how to set proxy in httpwebrequest listbox1.items
    • I want to run the program with a proxy variable
    • Please Help code login and proxy

    • Edited by A-R-2017 Friday, November 10, 2017 12:40 AM
    Friday, November 10, 2017 12:39 AM

Answers

  • Hi A-R-2017,

    You can try the following code, I use two ListBox control in my code.

     Dim myProxy As WebProxy
                For Each proxy As String In ListBox1.Items
                    Try
                        myProxy = New WebProxy(proxy)
                        Dim r As HttpWebRequest = HttpWebRequest.Create()
                        r.UserAgent = ""
                        r.Timeout = 3000
                        r.Proxy = myProxy
                        Dim re As HttpWebResponse = r.GetResponse()
                        ListBox2.Items.Add("Working Proxy: " & proxy)
                    Catch ex As Exception
                        ListBox2.Items.Add("Unresponsive Proxy: " & proxy)
                    End Try
                Next

    I also find one helpful article that you can refer to:

    https://www.sourcecodester.com/tutorials/visual-basic/5709/visual-basic-proxy-checker.html

    Best regards,

    Cherry


    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.

    • Marked as answer by A-R-2017 Friday, November 10, 2017 10:10 PM
    Friday, November 10, 2017 6:38 AM
    Moderator