I am new to C# and I have an SSIS script task that I want want to move a file on a ftp to another folder but I want to make sure I close the connection after if it is open still.
//Move the File to Archive Folder
FtpWebRequest ftpRequest = (FtpWebRequest)WebRequest.Create(FTPFileFullPath);
ftpRequest.Credentials = new NetworkCredential(UserName, Password);
ftpRequest.Method = WebRequestMethods.Ftp.Rename;
ftpRequest.RenameTo = ArchFilePath;
FtpWebResponse ftpResp = (FtpWebResponse)ftpRequest.GetResponse();
ftpRequest.KeepAlive = false; // close connection... not sure
Dts.TaskResult = (int)ScriptResults.Success;
I have put .KeepAlive = false, is this the correct method, any tips most welcome.