If you are looking for a simple way for your application to move files between remote servers than it is worth considering FTP. The following code shows how simple it is to upload a file via FTP with c#.
// File to be uploaded string fileName = @"c:\temp\MyFile.zip"; // URL containg remote location and name of file string remoteServer = "ftp://[ServerName]/" + Path.GetFileName(fileName); // Please don't store userNames and passwords like this! string userName = ""; string pass = ""; //Create the request FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(remoteServer); request.Method = WebRequestMethods.Ftp.UploadFile; request.Credentials = new NetworkCredential(userName, pass); request.UsePassive = true; request.UseBinary = true; request.KeepAlive = false; // Read the file to be uploaded into a byte array FileStream stream = File.OpenRead(fileName); byte[] buffer = new byte[stream.Length]; stream.Read(buffer, 0, buffer.Length); stream.Close(); // Get the stream for the request and write the byte array to it Stream reqStream = request.GetRequestStream(); reqStream.Write(buffer, 0, buffer.Length); reqStream.Close();






Some
of you may be familiar with an open source project called
Mono which was aimed at making .Net applications run on the linux
platform. A similar project has now been built by