Thread: C# основной форум/Secure FTP

Secure FTP

www.codeproject.com/KB/IP/FTP_Secure.aspx


 





Re: Secure FTP

www.tamirgal.com/blog/page/SharpSSH.aspx





Re: Secure FTP

www.example-code.com/csharp/sftp_uploadFile.asp





Re: Secure FTP

sharpSsh - A Secure Shell (SSH) library for .NET


www.codeproject.com/KB/IP/sharpssh.aspx


 


string filePath = @"C:\FtpFrom\File.txt";





string userName = "yourUserName";

string host = "YourServerName";

string password = "YourPassword";



Sftp sftpClient = new Sftp(host, userName, password);



sftpClient.Connect();



sftpClient.Put(filePath, @"Foleder1/Folder2/File.txt");


---------------------------------------------------------------------------------------------


JSch jsch=new JSch();

//Add identity for public key user authentication

jsch.addIdentity(privateKeyFile);

Session session=jsch.getSession(user, remoteHost, 22);

//No need for password here

//session.setPassword( pass );

Hashtable config=new Hashtable();

config.Add("StrictHostKeyChecking", "no");

session.setConfig(config);session.connect();

Channel channel=session.openChannel("sftp");

channel.connect();

ChannelSftp c=(ChannelSftp)channel;

//do the upload

c.put(sourceFile, destFile);

channel.disconnect();


----------------------------------------------------------------------------------------------


JSch jsch=new JSch();

Session session=jsch.getSession(user, remoteHost, 22);

session.setPassword( pass );



Hashtable config=new Hashtable();

config.Add("StrictHostKeyChecking", "no");

session.setConfig(config);



session.connect();



Channel channel=session.openChannel("sftp");

channel.connect();

ChannelSftp c=(ChannelSftp)channel;



//do the upload

c.put(sourceFile, destFile);

channel.disconnect();


----------------------------------------------------------------------------------------------


 


 

-- 18/01/2010 11:03:18: post edited by sergey.