I am using a trial version. We are evaluating for an application that will be distributed to many clients.
I can easily connect using code like this:
sftp = New SecureFTPConnection
sftp.ServerAddress = ftpServer
sftp.ServerPort = 990
sftp.UserName = ftpUser
sftp.Password = ftpPassword
sftp.ConnectMode = FTPConnectMode.ACTIVE
sftp.Protocol = FileTransferProtocol.FTPSImplicit
sftp.ServerValidation = SecureFTPServerValidationType.None
sftp.SSLVersion = SSLFTPSSLVersion.SSL3
sftp.Timeout = 15
sftp.Connect()
I am having problems validating a connection. For example, i have a settings screen. I have a button called Test FTP so that a client can test that they entered the approriate settings.
I have the code above wrapped in a Try - Catch, but the error never gets thrown. I get this when a wrong IP Address is used:
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="edtFTPnetPRO"
StackTrace:
at gv.b(Exception A_0)
at ev.h(IAsyncResult A_0)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.ContextAwareResult.CompleteCallback(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.ContextAwareResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.Sockets.Socket.ConnectCallback()
at System.Net.Sockets.Socket.RegisteredWaitCallback(Object state, Boolean timedOut)
at System.Threading._ThreadPoolWaitOrTimerCallback.PerformWaitOrTimerCallback(Object state, Boolean timedOut)