开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜