FTP Tool Error
"The requested URI is invalid for this FTP command"
I am running this as a web app on my local machine and trying to FTP a file to a Linux server. Any idea what I might be doing wrong. Any help would be greatly appreciated.Here is my class:
using System;
using System.IO;
using System.Net;
using System.Text;
public class ftp
{
public ftp ()
{
// Get the object used to communicate with the server.
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://69.94.78.121");
request.Method = WebRequestMethods.Ftp.UploadFile;
// This example assumes the FTP site uses anonymous logon.
request.Credentials = new NetworkCredential("username", "password");
// Copy the contents of the file to the request stream.
StreamReader sourceStream = new StreamReader("C:/Inetpub/wwwroot/cloakmanager/files2trans/ideas.txt");
byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
sourceStream.Close();
request.ContentLength = fileContents.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(fileContents, 0, fileContents.Length);
requestStream.Close();
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription);
response.Close();
}
}

