Doing FTP over explicit TLS/SSL

B

BobRoyAce

I can use FileZilla to connect to an FTP site with a certain Username
and Password. However, when I try to use code below to connect to the
site, it fails with error stating:

"The remote server returned an error: (550) File unavailable (e.g.,
file not found, no access)."

Now, assuming that the url does exist, and the Username and Password
are correct, what else could cause the problem? How do I fix this?
Should it be as simple as the code below?

NOTE: The first time I connected via FileZilla, a large dialog box
came up and I had to confirm something (i.e. something that I can't
remember, now). However, I checked off some box in FileZilla so that
I wouldn't see the large dialog box again.

--- CODE BEGINS ---

Dim result As FtpStatusCode
Dim req As FtpWebRequest
Dim resp As FtpWebResponse
Dim creds As New NetworkCredential(_Username, _UserPassword)

req = DirectCast(WebRequest.Create(url), FtpWebRequest)

With req
.Credentials = creds
.UseBinary = False
.EnableSsl = True
.UsePassive = False
.KeepAlive = True

' Make initial connection
.Method = "LIST"
resp = .GetResponse ' THIS LINE FAILS!!!

data = resp.GetResponseStream
result = resp.StatusCode
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top