Doing FTP over explicit TLS/SSL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BobRoyAce

    Doing FTP over explicit TLS/SSL

    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 NetworkCredenti al(_Username, _UserPassword)

    req = DirectCast(WebR equest.Create(u rl), 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.GetRespons eStream
    result = resp.StatusCode
    End With
Working...