Results 1 to 4 of 4

Thread: Webclient via proxy

  1. #1

    Thread Starter
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840

    Webclient via proxy

    Hi.

    I have previously used the Webclient object to download files and pages. But on my company pc we use a proxy to access the internet, and I can't get it to work.

    Does anyone know how to use the same proxy settings as the ie?
    The best thing would of course be for the app. to adopt the ie proxy settings automatically.

    I have been looking at GlobalProxySelection, but I have not been able to figure it out.

    I have never done anything like this before, so please explain it like I was 4 years old...

    Edit: I have searched and seen some threads about this, but they all went over my head...
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  2. #2
    Hyperactive Member Bloged's Avatar
    Join Date
    May 2001
    Location
    Rotterdam, The Netherlands
    Posts
    330
    Maybe this MSDN-page can be of some help to you! Especially this: INTERNET_OPEN_TYPE_PRECONFIG part!

    Grtz,

    Bloged

  3. #3

    Thread Starter
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi.

    Well, thanks for your answer, Bloged. It appears to do what I want. But I'm afraid that all my follwing operations would rely on the handle from this function. This would mean, that I have to stick with the API's.

    I was kinda hoping there would be a .NET-way of doing this.
    And I think there must be...with all the proxy and security etc. classes available.
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  4. #4
    New Member
    Join Date
    Mar 2004
    Posts
    2
    From here , it looks like you can do this:

    VB Code:
    1. Dim myWebRequest As HttpWebRequest = CType(WebRequest.Create("http://www.microsoft.com"), HttpWebRequest)
    2. Dim myProxy As WebProxy = CType(myWebRequest.Proxy, WebProxy)
    3. ' Print the Proxy Url to the console.
    4. Console.WriteLine(ControlChars.Cr + "The actual default Proxy settings are {0}", myProxy.Address)

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