I'm having this problem, I'm trying to upload a file to FTP site, the code is:
reqFTP = DirectCast(FtpWebRequest.Create(New Uri(URI & tmpDirFile)), FtpWebRequest)
reqFTP.Method = WebRequestMethods.Ftp.UploadFile
reqFTP.UseBinary = True
reqFTP.KeepAlive = False
reqFTP.UsePassive = True
reqFTP.Credentials = New NetworkCredential(UserID, Pwd)
reqFTP.ContentLength = fileContents.Length
ftpStream = reqFTP.GetRequestStream()
ftpStream.Write(fileContents, 0, fileContents.Length)
ftpStream.Flush()
ftpStream.Close()
the issue is that the code is working but not always, the setting of the server does not change (it is a basic FTP server without username and password), so I don't understand what it is happening, I hope somebody get this problem and found the solution
The error return is: The remote server returned an error: (425) Can't open data connection.
question from:
https://stackoverflow.com/questions/65946255/ftpwebrequest-in-vb-net-not-working-all-the-time 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…