Answers for "delete file from ftp server c#"

C#
0

delete file from FTP c#

private string DeleteFile(string fileName)    
{    
   FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://www.server.com/" + fileName);    
   request.Method = WebRequestMethods.Ftp.DeleteFile;    
   request.Credentials = new NetworkCredential("username", "password");    
    
   using (FtpWebResponse response = (FtpWebResponse)request.GetResponse())    
   {    
      return response.StatusDescription;        
   }    
}
Posted by: Guest on January-14-2021

C# Answers by Framework

Browse Popular Code Answers by Language