VB.NET Process.Start working on one machine but not another.
Hi all,
I have some very simple code running in a VB Application that calls WinSCP.com in order to download a file. On my development machine I default installed WinSCP, wrote the code and everything worked perfectly. I installed the same WinSCP the same way on the live machine for getting this data and the ExitCode is now being returned as 1 not the expected 0.
I added log file generation to the code - my machine works fine but the live machine doesn't generate a log file even though I have checked in my code that the WinSCP process is running. As per the FAQ's I put WinSCp in the path so it can be accessed from anywhere on the machine - still nothing.
I've tried setting up the security settings on everything I can find to All Access - still nothing.
I'm basically stumped as to what to look for or how to get more information from WinSCP to give me a clue whats going wrong here. Anybody got any ideas????
Here's a cut down version of the code - currently it's full of debug stuff that might just confuse things if I left it in (obviously all variables e.g. host, password, TargetFile etc. are valid at run time)
Cheers
/Stuart
I have some very simple code running in a VB Application that calls WinSCP.com in order to download a file. On my development machine I default installed WinSCP, wrote the code and everything worked perfectly. I installed the same WinSCP the same way on the live machine for getting this data and the ExitCode is now being returned as 1 not the expected 0.
I added log file generation to the code - my machine works fine but the live machine doesn't generate a log file even though I have checked in my code that the WinSCP process is running. As per the FAQ's I put WinSCp in the path so it can be accessed from anywhere on the machine - still nothing.
I've tried setting up the security settings on everything I can find to All Access - still nothing.
I'm basically stumped as to what to look for or how to get more information from WinSCP to give me a clue whats going wrong here. Anybody got any ideas????
Here's a cut down version of the code - currently it's full of debug stuff that might just confuse things if I left it in (obviously all variables e.g. host, password, TargetFile etc. are valid at run time)
Dim SFTP_APP_LOCATION As String = "C:\Program Files\WinSCP\winscp.com"
Dim winscp As Process = New Process
winscp.StartInfo.FileName = SFTP_APP_LOCATION
winscp.StartInfo.Arguments = "/log=c:\Start_working_folder\App.log"
winscp.StartInfo.UseShellExecute = False
winscp.StartInfo.CreateNoWindow = True
winscp.StartInfo.RedirectStandardInput = True
winscp.Start()
' Use Process.GetProcessesByName("WinSCP")
winscp.StandardInput.WriteLine("open sftp://" & username & "@" & Host)
winscp.StandardInput.WriteLine(password) 'password characters not compatible with open statement
Dim commandline As String = "get /log/" & TargetFile & " " & LocalFile
winscp.StandardInput.Close()
winscp.WaitForExit()
Dim result as integer = winscp.ExitCodeCheers
/Stuart