kannan ramakrishnan
FTP Remote path and get file properties in C#
By kannan ramakrishnan in C# on Oct 27 2010
  • kannan ramakrishnan
    Oct, 2010 27

    Any one please guide me to get remote file properties from ftp server,i can access the directory and files name via "ftp://servername/directoryname" through web request class and through ftp.list directory method.but to get the file size if i send the same path it says invalid path.

     

    FtpWebRequest ftp;

     ftp = (FtpWebRequest)FtpWebRequest.Create(new    Uri("ftp://"+ftpServerIP+"/Directory name"));

     ftp.Credentials = new NetworkCredential(ftpUserID, ftpPassword);

     ftp.Method = WebRequestMethods.Ftp.GetFileSize;           

    WebResponse response = ftp.GetResponse();

    long filesize = response.ContentLength;

     

              The code can be in vb.net or c#.net.please help me

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS