Topic ".NET assembly wrapper class"

Author Message
Priti
[View user's profile]

Joined: 2012-03-29
Posts: 3
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
Advertisements
Priti
[View user's profile]

Joined: 2012-03-29
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()
Priti
[View user's profile]

Joined: 2012-03-29
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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Please, set Session.DebugLogPath and Session.SessionLogPath and post or email me the logs.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License