Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4k views
in .NET FTP by
Hi

I have made a ftp upload class from your Demo.vb, but the function ftp.login(user, password) throws an exception?

The FTP client has not yet connected to the server. The requested action cannot be performed until after a connection has been established.

at EnterpriseDT.Net.Ftp.FTPClient.CheckConnection(Boolean shouldBeConnected)
at EnterpriseDT.Net.Ftp.FTPClient.Login(String user, String password)
at elstock.FtpUpload..ctor(String ftphost, String ftpuser, String ftppassword, String ftpfile) in C:\Documents and Settings\Jakob\Desktop\BIG Projekt\ElstockBig\FtpUpload.vb:line 21

Here's the code.:

Imports System
Imports EnterpriseDT.Util.Debug
Imports EnterpriseDT.Net.Ftp

Public Class FtpUpload

Public Sub New(ByVal ftphost As String, _
ByVal ftpuser As String, _
ByVal ftppassword As String, _
ByVal ftpfile As String)


Dim host As String = ftphost
Dim user As String = ftpuser
Dim password As String = ftppassword

Dim ftp As FTPClient = Nothing
Try
Debug.WriteLine("Connecting")
ftp = New FTPClient()
ftp.RemoteHost = host

Debug.WriteLine("Logging in")
ftp.Login(user, password)

Debug.WriteLine("Setting up passive, ASCII transfers")
ftp.ConnectMode = FTPConnectMode.PASV
ftp.TransferType = FTPTransferType.ASCII

Debug.WriteLine("Putting file")
ftp.Put(ftpfile, ftpfile)

Debug.WriteLine("Quitting client")
ftp.Quit()
Debug.WriteLine("Test complete")

Catch e As Exception
Debug.WriteLine(e.Message)
Debug.WriteLine(e.StackTrace)
End Try
End Sub


I have no problems logging on to the ftp server, from an explorer..

Any help is appreciated.

Jakob

2 Answers

0 votes
by
I have exactly the same problem, execpt the same code was working great on another computer!

Did you ever figure it out?
0 votes
by (162k points)
You must call the Connect() method to connect - before Login()

I have exactly the same problem, execpt the same code was working great on another computer!

Did you ever figure it out?

Categories

...