I've created this application for some clients and for some odd reason it is not working for 1 of my clients.

its seems to download a file no problem using this code

Dim request As FtpWebRequest = Nothing
        Dim response As FtpWebResponse = Nothing
        Dim respstrm As Stream = Nothing
        Dim filestrm As FileStream = Nothing
        Dim path1 As String = IO.Path.GetTempPath()
        Dim credential As New NetworkCredential(get_user() & "@host.com", get_password())

        Try

            request = DirectCast(WebRequest.Create(target), FtpWebRequest)

            request.Credentials = credential

            request.Method = WebRequestMethods.Ftp.DownloadFile
            response = DirectCast(request.GetResponse(), FtpWebResponse)
            respstrm = response.GetResponseStream()


            path1 = path1 & Path.GetFileName(request.RequestUri.LocalPath)

            filestrm = File.Create(path1)
            Dim buff(1023) As Byte
            Dim bytesRead As Integer = 0

            While (True)
                bytesRead = respstrm.Read(buff, 0, buff.Length)
                If (bytesRead = 0) Then Exit While
                filestrm.Write(buff, 0, bytesRead)
            End While
            respstrm.Close()
            filestrm.Close()

but when i try to look for a folder using this code it doesn't work

Dim fwr As FtpWebRequest = FtpWebRequest.Create("ftp://ftp.host.com/menusaved/" & MonthName(menuday.Month) & " " & menuday.Year & "/")

        strFile = "menusaved " & menuday.Month & "-" & menuday.Day & "-" & menuday.Year & ".bin"

        fwr.Credentials = New NetworkCredential(get_user() & "@host.com", get_password())

        fwr.Method = WebRequestMethods.Ftp.ListDirectory

        Dim sr As New StreamReader(fwr.GetResponse().GetResponseStream())
        Dim str As String = sr.ReadLine()

        While (Not str Is Nothing)
            If str = strFile Then
                fileflag = True
                Exit While
            End If
            str = sr.ReadLine()
        End While
        sr.Close()
        sr = Nothing
        fwr = Nothing

I just keep getting error 530 not logged in. It only happens on her computer. I don't have that problem when trying it on my side or other computers around me.

Is her computer in the same environment as your own computer?
Perhaps her computer is behind a firewall (or Windows Firewall) that requires her ftp client to connect using Passive FTP.

Perhaps you should consider using a custom ftp client for your application.
Take a look at this FTP client.

This might be just silly, but have you verified that her username/password is active (not locked, not expired,etc)?

yea username and password is the same as the login username and password. Her network is a bit different she does connect to a domain .local . She hasnt gotten in touch with the administrator as I can't turn off her firewall or antivirus. Her port 21 is not closed as I was able to install firezilla on her computer and login from there. So somehow I cant have the code read the list of directory but somehow I can get it to download a file from the server.

This article has been dead for over six months. Start a new discussion instead.