Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
7.5k views
in .NET FTP by
Hey
i'm using to connect over SSL using the following code
    Dim host As String = "host"
        Dim user As String = "user"
        Dim password As String = "password"
        Logger.CurrentLevel = Level.ALL
        Dim ftp As ProFTPClient = Nothing
        ' Try
        log.Info("Connecting")

        ftp = New ProFTPClient
        ftp.RemoteHost = host
        ftp.ServerValidation = ProFTPClient.ServerValidationType.None
        'Dim cert As ProFTPCertificate = ProFTPCertificate.CreateFromCER_PVK("C:\certificate\bin\testing.cert", "C:\certificate\bin\testing.pvk", "test")
        ftp.IsImplicitFTPS = True
        ftp.ServerCompatibility = ProFTPClient.CompatibilityFlags.DisableDataSSLClosure
        ftp.ServerValidation = ProFTPClient.ServerValidationType.None
        ftp.Connect()
        ftp.Auth()
        ftp.Login(user, password)
        ftp.ConnectMode = EnterpriseDT.Net.Ftp.FTPConnectMode.PASV
        ftp.TransferType = EnterpriseDT.Net.Ftp.FTPTransferType.BINARY
        'Response.Write("Directory before put:")
        Dim files As Array = ftp.Dir(".", True)


Everything is fine and the connection is established, however when the execution reaches the last line 'Dim files As Array = ftp.Dir(".", True)'

I got the following error:

Only changing from a normal connection to a secure connection is supported.

can you tell me why?

8 Answers

0 votes
by (162k points)
Can you post the log file please?

Everything is fine and the connection is established, however when the execution reaches the last line 'Dim files As Array = ftp.Dir(".", True)'

I got the following error:

Only changing from a normal connection to a secure connection is supported.

can you tell me why?
0 votes
by
I don't know where is the log file located, but the "LastValidReply" I got before calling the
files As Array = ftp.Dir(".", True)' 
is
ftp.LastValidReply
{EnterpriseDT.Net.Ftp.FTPReply}
    ReplyCode: "200"
    ReplyData: Nothing
    ReplyText: "Type set to A." 
0 votes
by
again here is the piece of code
 FTP.RemoteHost = host
        FTP.IsImplicitFTPS = True
        FTP.ServerCompatibility = ProFTPClient.CompatibilityFlags.DisableDataSSLClosure
        FTP.ServerValidation = ProFTPClient.ServerValidationType.None
        FTP.Connect()
        FTP.Auth()
        FTP.Login(user, password)
        FTP.ConnectMode = FTPConnectMode.PASV
        FTP.TransferType = FTPTransferType.ASCII


        Try
            Dim files As Array = FTP.Dir(".", True)
            Dim i As Integer = 0
            While i < files.Length
                Response.Write(files(i) & "<BR><BR><BR>")
                i += 1
            End While
        Catch ex As Exception
            Response.Write("ERROR" & ex.Message & "<BR>")
        End Try


i've catched CommandSent and ReplyRecieved to capture FTP messages and I got the following
---> PBSZ 0
200 PBSZ=0
---> PROT P
200 PROT command successful.
---> USER dmpuser
331 Password required for dmpuser.
---> PASS ********
230 User dmpuser logged in.
---> TYPE A
200 Type set to A.
---> PASV
227 Entering Passive Mode (10,1,21,49,98,235)
ERROR Only changing from a normal connection to a secure connection is supported.


can you tell me what's wrong?
thanks
0 votes
by
When I changed FTP.ConnectMode = [code]FTPConnectMode.Passive[code] to [code]FTP.ConnectMode = FTPConnectMode.ACTIVE[/code] everything works fine, so is it required that implicit SSL is active connection and can't be Passing?
0 votes
by
When I changed FTP.ConnectMode =
FTPConnectMode.Passive
to
FTP.ConnectMode = FTPConnectMode.ACTIVE
everything works fine, so is it required that implicit SSL is active connection and can't be Passing?
0 votes
by (162k points)
Is it possible that there is a firewall blocking passive connections? This is often the case.

When I changed FTP.ConnectMode =
FTPConnectMode.Passive
to
FTP.ConnectMode = FTPConnectMode.ACTIVE
everything works fine, so is it required that implicit SSL is active connection and can't be Passing?
0 votes
by
I have windows XP and i've disabled the firewall, note that the server and the client application are both on the same machine. is there other possibilities?
0 votes
by
Also Passive mode is working with explicit SSL but not with implicit SSL

Categories

...