Results 1 to 6 of 6

Thread: [RESOLVED] [2005] WebClient Proxy

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2007
    Posts
    153

    Resolved [RESOLVED] [2005] WebClient Proxy

    How do I mask my webclient with a proxy? I need to download a page, but I need to download it with a specified proxy. Any help?


  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] WebClient Proxy

    Code:
            Dim MyWebClient As New Net.WebClient
            Dim MyWebProxy As New Net.WebProxy
            Dim MyCredentials As New Net.NetworkCredential
            With MyCredentials
                .UserName = "kleinma"
                .Password = "secret"
            End With
            With MyWebProxy
                .Address = New Uri("proxy addr here")
                .Credentials = MyCredentials
                .BypassProxyOnLocal = True 'or false
            End With
            MyWebClient.Proxy = MyWebProxy

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2007
    Posts
    153

    Re: [2005] WebClient Proxy

    Thakns very much, resolved


  4. #4
    New Member
    Join Date
    Jan 2012
    Posts
    6

    Re: [RESOLVED] [2005] WebClient Proxy

    When i use this in VS 2010
    then i get a warning:
    Warning 1 Variable 'Mywebproxy' is used before it has been assigned a value. A null reference exception could result at runtime.

    Please help me with this.

  5. #5
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [RESOLVED] [2005] WebClient Proxy

    The only reason you would get a warning like that is if you forgot to put the "New" keyword in the line that declares the myWebProxy variable. If you retyped the example code and didn't copy/paste it, then that is likely your issue.

  6. #6
    New Member
    Join Date
    Jan 2012
    Posts
    6

    Re: [RESOLVED] [2005] WebClient Proxy

    thank you
    I got it

Posting Permissions

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



Click Here to Expand Forum to Full Width