Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
7.9k views
in .NET FTP by (140 points)
I am trying to understand just what to put in the get arguments. The documentation says the first argument is a stream but the error message says it is a path. Which is it and how do I make this code rock?

Thanks!

Bob



********My Error -
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll

Additional information: Access to the path "C:\Documents and Settings\Bob\My Documents\Visual Studio Projects\edtFTPnet\edtFTPnet\bin" is denied.

********My code
Imports EnterpriseDT.Net.Ftp

(Windows Form Designer generated code)


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim ftp As New FTPClient("www.mysite.org")
ftp.Login("username", "password")
ftp.ConnectMode = FTPConnectMode.PASV
ftp.TransferType = FTPTransferType.BINARY
ftp.Get(CurDir(), "jesuslovesyou.htm")
ftp.Quit()
End Sub

1 Answer

0 votes
by (161k points)
The method is overloaded - it takes a stream or a path.

The error is in

ftp.Get(CurDir(), "jesuslovesyou.htm")

The first argument must be a filename,

e.g.

ftp.Get(CurDir() + "\\jesusloveseveryone.htm", "jesuslovesyou.htm")

(something like this anyway - i'm not a VB programmer)

You've supplied a directory - which is what the error message is telling you.

I am trying to understand just what to put in the get arguments. The documentation says the first argument is a stream but the error message says it is a path. Which is it and how do I make this code rock?

Categories

...