West Wind Internet and Client Tools
Cannot access a disposed object. Object name: 'Renci.SshNet.SftpClient'.
Gravatar is a globally recognized avatar based on your email address. Cannot access a disposed object. Object name: 'Renci.SshNet.SftpClient'.
  Jeff L
  All
  Dec 18, 2020 @ 12:30pm

Hi Rick,

I'm trying to use the Shareware version of Client Tools to FTP (sftp) to my server.

I believe I'm supposed to use port 23.

I'm getting this error from the oFtp object:

Cannot access a disposed object. Object name: 'Renci.SshNet.SftpClient'.

thisform.oftp.nFtpPort = 23
lnResult = thisform.oFtp.FTPSendFile(;
				thisform.cftpservername,;
				"_junk.txt",;
				thisform.cFtpFolder + "_junk.txt",;
				thisform.cftpusername,;
				thisform.txtPassword.value;
			)

Gravatar is a globally recognized avatar based on your email address. re: Cannot access a disposed object. Object name: 'Renci.SshNet.SftpClient'.
  Rick Strahl
  Jeff L
  Dec 18, 2020 @ 12:56pm

Not sure... Just ran test with known working server (local) so I know it works. Make sure your server f name is correct - ie. just a domain name or ip address.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Cannot access a disposed object. Object name: 'Renci.SshNet.SftpClient'.
  Jeff L
  Rick Strahl
  Dec 18, 2020 @ 05:06pm

Thanks, Rick.

Problem was on my end. I was assuming that my FTP accounts that I created on domains that have an SSL cert would be SFTP.

Instead, only my main cpanel user can use SFTP.

Gravatar is a globally recognized avatar based on your email address. re: Cannot access a disposed object. Object name: 'Renci.SshNet.SftpClient'.
  Rick Strahl
  Jeff L
  Dec 18, 2020 @ 06:54pm

Sucks that we get that error message though - a better error message certainly would be nicer.

But the underlying library is not very good at error handling - it handles but doesn't provide deep error info unfortunately. Mainly because SFTP is basically shell driven SSH commands and often the messages returned can't be parsed easily since every server does its own thing.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Cannot access a disposed object. Object name: 'Renci.SshNet.SftpClient'.
  Jeff L
  Rick Strahl
  Dec 19, 2020 @ 09:37am

And consider the fact that the old school FTP Server that was trying to be connected to probably didn't understand what was being sent to it either.

© 1996-2021