// Reanme file or remove file
public bool FtpRename()
{
if (this.InputValidation())
{
try
{
Uri UriFtpMove = new Uri("ftp://" + serverhost + ":" + serverport + dirpath + remotefile);
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(UriFtpMove);
request.Method = WebRequestMethods.Ftp.Rename;
request.RenameTo = renamefile;
request.Credentials = new NetworkCredential(username, password);
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
returnmsg = response.BannerMessage;
returncode = response.StatusCode.ToString();
return true;
}
catch (Exception ex)
{
returnmsg = ex.ToString();
returncode = "0";
return false;
}
}
else
{
throw new ArgumentException(returnmsg);
}
}
沒有留言:
張貼留言