I did manage to get ftp working. The problem was typing in the password, I could not redirect the input when it was the password, I had no problem with the user name. The way I solved by using -n argument in ftp and then using "user <id> <password>" in the ftp session to authenticate
ftp -n <ip> (suppress auto-login upon initial connection)
I found out that when I redirect the output as well as the input I do not get anything written to the window although the FTP succeed. This prevented me from reading the output.
The code would look something like that
pStart.FileName = Directory.GetCurrentDirect
pStart.RedirectStandardInp
pStart.UseShellExecute = False
ftpProcess.StartInfo = pStart
ftpProcess.Start()
Dim stWriter As StreamWriter
stWriter = ftpProcess.StandardInput
stWriter.AutoFlush = True
stWriter.WriteLine("user ftpuser ftpuser")
tWriter.WriteLine("mput " & targetDirectory& "results.rpt")
stWriter.WriteLine("y")
stWriter.WriteLine("bye") ''' **** I cannot close the session unless I know that the ftp complete
The problem with this code is:
I have to wait for the ftp to finish (the file is big around 100 MB and will take a while) before I can close the ftp session and then the process.
I need to check the ftp session has completed and then after that stop the FTP Publishing Service, or at least close the process.
Main Topics
Browse All Topics





by: iboutchkinePosted on 2003-03-30 at 06:30:53ID: 8233800
I have recently did the same. I found out that NCFTP works much better then FTP. You can dowload NCFTP from here
"
http://ncftp.com
here you can find all the options for upload/download
Uou will find ther the syntax for upload/download. For example the upload ( batch file)
ncftpput [options] remote-host "remote-directory" "local-files..."
ncftpput -Z -u username -p password IPAddress "PathOnServer" "PathOnClient"
and the call the batch file like that
Imports System.Diagnostics.Process
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim proc As New Process()
proc.StartInfo.FileName = "c:\temp\YourBaychFile.bat
proc.Start()
End Sub
End Class