Results 1 to 10 of 10

Thread: download

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    download

    Hi everyone,
    Could you giude me on the following topic please, or what topic does this come under?
    Thanks

    I would like to download files from a web site and place them on my local machine.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Very basic code for downloading files :
    VB Code:
    1. Dim dl As New Net.WebClient
    2. dl.DownloadFile(-,-)

  3. #3
    New Member
    Join Date
    Jul 2003
    Posts
    9
    I am trying to download a file, and using the code above gives me a 407 error (Proxy Authentication Required). I can't download any files from any site, so it's not a password-related issue. Could it be something to do with the server at my end? Any ideas would be much appreciated.

    Thanks,
    Vulpes

  4. #4
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Yes, you are using an authenticating proxy to connect to internet. This settings works for any program that tries to use the Internet Settigns of Windows, however some browsers like Netscape and Opera use their own settings.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  5. #5
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    To authenticate proxy you can use:
    VB Code:
    1. Dim dl As New Net.WebClient
    2. Dim wp As New Net.WebProxy("proxyserver", portnumber)
    3. Dim cr As New System.Net.NetworkCredential("username", "pass")
    4. wp.Credentials = cr
    5. Net.GlobalProxySelection.Select = wp
    6. dl.DownloadFile("url", "file")
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  6. #6
    New Member
    Join Date
    Jul 2003
    Posts
    9
    Thanks Lunatic3 - just to clarify, "username", "pass" and "proxyserver" refer to my local domain settings?

  7. #7
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Yes, but not necessarily. Sometimes to connect to special resources you need to connect through a proxy server that is not on your local domain. And also you can have a settings part in your program that lets user set the proxy server and then a pop up window that asks for username and password.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  8. #8
    New Member
    Join Date
    Jul 2003
    Posts
    9
    Thanks again for the help - I just managed to get it working about 5 minutes ago. Ironically the hardest part so far was finding out the name of the local proxy server

    -Vulpes

  9. #9
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    There is a method that automatically deted the nondynamic proxy settings of Internet Explorer
    VB Code:
    1. Try
    2.    Dim wp As New Net.WebProxy(Net.WebProxy.GetDefaultProxy.Address)
    3.    MessageBox.Show(wp.Address.ToString)
    4. Catch ex As Exception
    5.    'Either no proxy or some other errors.
    6. End Try
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  10. #10
    New Member
    Join Date
    Jul 2003
    Posts
    9
    Wow that'll save me some time - was wondering how I would make the program work for anyone. Thanks again

    -Vulpes

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