Loging into an FTP with .NET
On the WebClient page i see the following
By default, the .NET Framework suppor开发者_JS百科ts URIs that begin with http:, https:, ftp:, and file: scheme identifiers.
The FTP i am using requires a login. How do i login with WebClient to download a file?
You need to set the credentials on the WebClient object, e.g.
Dim ftpReq As FtpWebRequest = WebRequest.Create(filename)
ftpReq.Method = WebRequestMethods.Ftp.DownloadFile
ftpReq.Credentials = New NetworkCredential("anonymous", "password")
See here.
Try setting the Credentials property of the WebClient to your FTP username and password.
You'll need to pass in Credentials.
精彩评论