System.Net.FtpWebResponse.Close C# (CSharp) Method

Close() public method

Closes the underlying FTP response stream, but does not close control connection

public Close ( ) : void
return void
        public override void Close()
        {
            if (NetEventSource.IsEnabled) NetEventSource.Enter(this);
            _responseStream?.Close();
            if (NetEventSource.IsEnabled) NetEventSource.Exit(this);
        }

Usage Example

Esempio n. 1
0
        public bool VerificaSeExiste(string destinfilepath, string ftphost, string ftpfilepath, string user, string pass)
        {
            ftpRequest = (FtpWebRequest)FtpWebRequest.Create("ftp://" + ftphost + "//" + ftpfilepath);

            ftpRequest.Method = WebRequestMethods.Ftp.DownloadFile;

            ftpRequest.Credentials = new NetworkCredential(user, pass);

            ftpRequest.UseBinary = true;
            ftpRequest.UsePassive = true;
            ftpRequest.KeepAlive = true;

            try {
                ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();
                ftpResponse.Close();                
                ftpRequest = null;
                return true;
            }
            catch (Exception exc)
            {
                this.sErro = exc.Message;                
                return false;
            }
             
        }
All Usage Examples Of System.Net.FtpWebResponse::Close