Wow, no replies. Well, I don't have the answer yet... I'm looking for it as are you (still?).
I can run this at home (no proxy) with no problems. At work, I must go through a proxy.
My IE setting are configured to use the proxy AND I have the Microsoft Firewall Client installed and configured to the same proxy. Still, the (407) Proxy Authentication Required exception is raised.
Try to set WebClient.Proxy to a value (don't try a string value... it wants a System.Net.Iwebproxy), but System.Net.IwebProxy is not in intellisense. However, there is a System.Net.WebProxy
OK, so I just solved it. See code in red, added to address proxy authtication.
Imports System.Net
Public Class Form1
Public Function FTPdnld(ByVal lsSrcURI As String, ByVal lsTargetFile As String) As Boolean
Dim lbRetVal As Boolean = False
Dim wc As New WebClient
Dim wp as new WebProxy
wp.UseDefaultCredentials = True
Try
wc.Proxy = wp
wc.DownloadFile(lsSrcURI, lsTargetFile)
MsgBox("file " & lsSrcURI & "downloaded to " & lsTargetFile, MsgBoxStyle.Information)
lbRetVal = True
Catch ex As Exception
MsgBox("download failed: " & ex.Message)
End Try
wc.Dispose()
Return lbRetVal
End Function
End Class