Search code examples
.netvb.netsharpssh

How to use SharpSSH SFTP library for .NET with a proxy?


i am using SharpSSH library to upload files to a SFTP server. I can do it fine through my home PC, but from my work's PC, I can not access the server. After contacting the sysadmins (located in another country), they told me I need to access the SFTP server via a proxy since all the company's internet access goes through that proxy.

I have searched a lot and while some posts indicated that this is possible I didn't understand how to do it in .NET (VB.NET specifically). Here's how the code that works perfect from home (or from a a gateway that bypasses the proxy...not possible for production) looks like

Dim objBo As New Tamir.SharpSsh.Sftp("STFP_SERVER_IP", "username", "password")
objBo.Connect()
objBo.Put(strFilename, "/outbox/master_" + Today.Date.ToString("ddMMyyyyHH") + Today.Now.Millisecond.ToString + ".TXT")
objBo.Put(strFilename2, "/outbox/detail_" + Today.Date.ToString("ddMMyyyyHH") + Today.Now.Millisecond.ToString + ".TXT")
objBo.Close()

How do I connect through a proxy?


Solution

  • It's been a long time since i asked this, but if i remember correct i solved this via doing a port forward on the server where the service was deployed.