I wonder if anyone can point me in the correct direction code wise. I am trying to upload file to a SFTP server. Just found out that WebRequestMethods does not do this. FTP no bother but not SFTP.
Was getting the error "remote name could not be resolved at Dim strz As System.IO.Stream = request.GetRequestStream()
As you can see, it is pretty standard stuff but need a wee bit of advice using SFTP or put me in the right direction.
What I have tried:
Dim request As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://sftp.mySFTPserver/Test.txt"), System.Net.FtpWebRequest)
request.Credentials = New System.Net.NetworkCredential(sFtpUserName, sFTpPassword)
request.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Dim file() As Byte = System.IO.File.ReadAllBytes("C:\test.txt")
Dim strz As System.IO.Stream = request.GetRequestStream()
Try
strz.Write(file, 0, file.Length)
strz.Close()
strz.Dispose()
Catch ex As Exception
MsgBox(Err.Description)
End Try