Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: .NET assembly wrapper class

Please, set Session.DebugLogPath and Session.SessionLogPath and post or email me the logs.
Priti

Dim UserOpenSessionString = "open sftp://" & UserID.ToString & ":" & Password.ToString & "@" & Machine.ToString _
& " -hostkey=" & Chr(34) & UnixSshHostKey.ToString & Chr(34)

Try
With SftpProcess.StartInfo
.FileName = WinSCPFileName
.UseShellExecute = False
.RedirectStandardInput = True
'.RedirectStandardOutput = True
.CreateNoWindow = True
End With

Try
SftpProcess.Start()

Catch ex As Exception
Response.Write(ex.ToString)
End Try

With SftpProcess.StandardInput
.WriteLine(UserOpenSessionString)
.WriteLine(ShellScript)
.WriteLine("exit")
.Close()
End With
Priti

??

But it does work on Production Server with the following code though:

Dim SftpProcess As Process = New Process()
Dim UserOpenSessionString = "open sftp://" & UserID.ToString & ":" & Password.ToString & "@" & Machine.ToString _
& " -hostkey=" & Chr(34) & UnixSshHostKey.ToString & Chr(34)

With SftpProcess.StartInfo
.FileName = WinSCPFileName
.UseShellExecute = False
.RedirectStandardInput = True
'.RedirectStandardOutput = True
.CreateNoWindow = True
End With

SftpProcess.Start()
Priti

.NET assembly wrapper class

Ok Back to Square one!!! I asked this question almost a month ago and had to switch for not using .net dll...but I need to use it and for some reason the following code runs fine on local server, but not on Production Server???? It gives Time-Out Exception?? What is the problem? Its not registering the Ssh Servers Host key in cache through the code even though I am hard coding it. Please help.

Dim iALPS_SessionOptions As New WinSCP.SessionOptions()

With iALPS_SessionOptions
.Protocol = Protocol.Sftp
.HostName = Machine.ToString
.UserName = UserID.ToString
.Password = Password.ToString
.SshHostKey = UnixSshHostKey.ToString
End With

Try
Using iALPS_Session As New WinSCP.Session
Try
iALPS_Session.Open(iALPS_SessionOptions)
Catch ex As Exception
Response.Write(ex.ToString())
End Try