Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.9k views
in .NET FTP by (360 points)
Using edFTP Express, I just ran across a issue that I am having trouble resolving. Here is the code that I get the issue with:

================
RemoteHtmlDirectory = "public_html"

' connect to the server
' By default, auto-login is on so Login doesn't need to be called
lbFileList.Items.Add("Connecting to server " & ServerAddress)
ftpConnection.Connect()
'if no internet avail, this throws exception
'if internet is working, this works fine

'Let's change to the proper directory
ftpConnection.ChangeWorkingDirectory(RemoteHtmlDirectory)

=====================================

How can I trap this error, or check ahead of time if the Internet connection is even active?

I am using VB2003.
:?: :?:

3 Answers

0 votes
by (51.6k points)
Have a look at this article:
http://www.codeproject.com/vb/net/CC_ConnectionStatePackage.asp

- Hans (EDT)
0 votes
by (360 points)
As I stated... VB.net 2003.

I read this article before and it did not translate to working vb.net 2003 code for me. That's when I came here and asked.

I was hoping that I had missed an option within the edtFTPnet/Express which checks internet availablity before trying to use the ftp.
0 votes
by (51.6k points)
Sorry, we don't have a feature for doing this. The best I can suggest (using the edtFTPnet API) is something like this:
Function TestConnection(serverAddress As string) As Boolean
  Dim cxn As New FTPConnection
  cxn.ServerAddress = serverAddress
  cxn.AutoLogin = False
  Try
    cxn.Connect
    Return True
  Catch
    Return False
  Finally
    cxn.Close
  End Try
End Sub


- Hans (EDT)

Categories

...