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.