Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).
no avatar
User

kfarah

Posts

14

Joined

Wed Jun 20, 2012 11:35 am

failures using the Exists method with SecureFTPConnection

by kfarah » Fri Aug 03, 2012 5:42 am

I am opening a passive FTP connection to a server tha accepts both FTP and SFTP connections. One I run an exists command using the SFTP connection I don't get any exceptions if I run the same code with an FTP connection I'm getting the following exception:

EnterpriseDT.Net.Ftp.FTPException: Unable to determine if file 'test' exists..

Here is the debug log

DEBUG [FTPConnection] 2 Aug 2012 12:37:35.626 : Set LocalDirectory='C:\svn\dev\branches\Product\Solution\TestResults\Framework _2012-08-02 12_37_34_\Out'
DEBUG [SecureFTPConnection] 2 Aug 2012 12:37:35.626 : Set LocalDirectory to C:\svn\dev\branches\Product\Solution\TestResults\Framework _2012-08-02 12_37_34_\Out
INFO [LicenseProperties] 2 Aug 2012 12:37:35.628 : Licence expiry date: 12/31/9999
INFO [LicenseProperties] 2 Aug 2012 12:37:35.628 : Production license
DEBUG [SSLFTPClient] 2 Aug 2012 12:37:35.628 : Connecting to sftp.mercent.com:21
DEBUG [SSLFTPControlSocket] 2 Aug 2012 12:37:35.629 : waitOnShutdownSSL=True
DEBUG [HostNameResolver] 2 Aug 2012 12:37:35.638 : Resolving sftp.mercent.com
DEBUG [HostNameResolver] 2 Aug 2012 12:37:35.642 : Obtained 1 addresses
DEBUG [HostNameResolver] 2 Aug 2012 12:37:35.642 : IP address: 184.72.102.212
DEBUG [HostNameResolver] 2 Aug 2012 12:37:35.642 : sftp.mercent.com resolved to 184.72.102.212
DEBUG [ExFTPControlSocket] 2 Aug 2012 12:37:35.642 : Connecting directly to ftp-server sftp.mercent.com:21
INFO [SSLFTPSocket] 2 Aug 2012 12:37:35.643 : Connecting to 184.72.102.212:21 with timeout 0 ms
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:35.716 : Setting socket timeout=0
INFO [FTPControlSocket] 2 Aug 2012 12:37:35.718 : Command encoding=System.Text.SBCSCodePageEncoding
DEBUG [ExFTPControlSocket] 2 Aug 2012 12:37:35.718 : Created control-socket: SocksContext=, ProxySettings=NoProxy, RemoteHost=sftp.mercent.com, controlPort=21, timeout=0
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:35.720 : StrictReturnCodes=False
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:35.788 : 220-Microsoft FTP Service
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:35.788 : 220 Welcome
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:35.792 : ---> USER Testftp1
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:35.864 : 331 Password required for Testftp1.
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:35.865 : ---> PASS ********
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:35.937 : 230 User logged in.
DEBUG [FTPConnection] 2 Aug 2012 12:37:35.937 : Successfully logged in
DEBUG [ExFTPConnection] 2 Aug 2012 12:37:35.939 : Starting KeepAlive thread with period 30s
INFO [FTPConnection] 2 Aug 2012 12:37:35.939 : Auto FEAT disabled
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:35.940 : ---> TYPE I
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:36.012 : 200 Type set to I.
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:36.012 : ---> PWD
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:36.136 : 257 "/" is current directory.
DEBUG [FTPConnection] 2 Aug 2012 12:37:36.138 : Exists(test)
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:36.139 : ---> SIZE test
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:36.212 : 550 Access is denied.
DEBUG [FTPClient] 2 Aug 2012 12:37:36.213 : SIZE not supported
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:36.213 : ---> MDTM test
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:36.284 : 550 The specified path is invalid.
DEBUG [FTPClient] 2 Aug 2012 12:37:36.284 : MDTM not supported
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:36.286 : ---> PORT 172,18,2,120,242,246
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:36.358 : 200 PORT command successful.
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:36.358 : ---> RETR test
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:36.431 : 550 Access is denied.
WARN [FTPClient] 2 Aug 2012 12:37:36.431 : Unable to determine if file 'test' exists.
DEBUG [FTPConnection] 2 Aug 2012 12:37:36.436 : Closing connection (instance=0)
DEBUG [FTPFileFactory] 2 Aug 2012 12:37:36.437 : Defaulting to Unix parsing
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:36.437 : ---> QUIT
DEBUG [ExFTPConnection] 2 Aug 2012 12:37:36.440 : KeepAlive thread finished.
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:36.510 : 221 Goodbye.
DEBUG [SecureSocket] 2 Aug 2012 12:37:36.511 : Shutdown(Both)


I've tried both active and passive connections.

Help!
Thanks,
Kathy
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: failures using the Exists method with SecureFTPConnectio

by support2 » Fri Aug 03, 2012 1:09 pm

no avatar
User

kfarah

Posts

14

Joined

Wed Jun 20, 2012 11:35 am

by kfarah » Fri Aug 03, 2012 1:10 pm

no avatar
User

kfarah

Posts

14

Joined

Wed Jun 20, 2012 11:35 am

by kfarah » Fri Aug 03, 2012 1:13 pm

I think the problem may actually be

DEBUG [FTPControlSocket] 2 Aug 2012 12:37:36.358 : ---> RETR test
DEBUG [FTPControlSocket] 2 Aug 2012 12:37:36.431 : 550 Access is denied.

What I don't understand is I can get to that directory with WinSCP no problem using FTP and SFTP. I can list it and add files. So I don't think it's an error on the server side.
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Fri Aug 03, 2012 1:23 pm

If you are trying to determine if a directory exists, try changing into it.

If you are trying to determine if a file exists, use Exists().
no avatar
User

kfarah

Posts

14

Joined

Wed Jun 20, 2012 11:35 am

by kfarah » Fri Aug 03, 2012 2:10 pm

I know the difference between changing directories and checking if a directory or file exists. I am trying to write a program that does both among other things. It's failing on the Exists. I'm testing which is how I know the directory exists, when this runs in production it will need to work. Are you saying that for FTP connections Exists does not work for directories?
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

by support2 » Fri Aug 03, 2012 2:34 pm

Yes, it should be called ExistsFile.
no avatar
User

kfarah

Posts

14

Joined

Wed Jun 20, 2012 11:35 am

by kfarah » Fri Aug 03, 2012 2:49 pm

that worked thank you!!!

Kathy

Who is online

Users browsing this forum: No registered users and 2 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron