0 votes
by (460 points)


I have a BIDS 2005 project, and I've been able to successfully open a connection to a SFTP server and put a file there using Rebex after generating the text file locally. However, what I'd really like to do would be:

  1. Open a connection to the sftp server
  2. Write the text file directly to the location
  3. Close the connection to the sftp server

However, in BIDS it won't let me use a ftp://ftp2... location for the destination file.

Any advice?


Applies to: Rebex SFTP

1 Answer

0 votes
by (18.0k points)

I'm not sure if I undestand your question completely. I think you probably need to upload a file from a stream - you can do it using following code:

// create client, connect and log in 
Sftp client = new Sftp();
client.Login(username, password);

// upload a text using a MemoryStream 
string message = "Hello from Rebex SFTP for .NET!";
byte[] data = System.Text.Encoding.Default.GetBytes(message);
System.IO.MemoryStream ms = new System.IO.MemoryStream(data);
client.PutFile(ms, "message.txt");

(the code has been taken from the SFTP Tutorial)

Anyway, don't use "ftp://ftp2.domain.com" for a hostname parameter in Connect method. -The hostname is only the "ftp2.domain.com" (without the "ftp://").

If you need more advice, please write again.