.NET assembly wrapper class

Advertisement

Priti
Joined:
Posts:
3

.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

Reply with quote

Advertisement

Priti
Joined:
Posts:
3

??

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()

Reply with quote

Priti
Joined:
Posts:
3

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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,227
Location:
Prague, Czechia

Re: .NET assembly wrapper class

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

Reply with quote

Advertisement

You can post new topics in this forum