ftpwebresponse

How to catch a FtpWebResponse exception in C#

I am building an FTP utility class in C#. In the case that a WebException is thrown on a call to FtpWebRequest.GetResponse(), in my case the exception is thrown for the requested file not existing on the remote server the FtpWebResponse variable is out of scope. But even if I declare the variable outside the try..catch block I get a co...

FtpWebRequest Download File

The following code is intended to retrieve a file via FTP. However, I'm getting an error with it. serverPath = "ftp://x.x.x.x/tmp/myfile.txt"; FtpWebRequest request = (FtpWebRequest)WebRequest.Create(serverPath); request.KeepAlive = true; request.UsePassive = true; request.UseBinary = true; request.Method = WebRequestMethods.Ftp.Dow...

How does this class implement IDisposable if it doesn't have a Dispose method?

FtpWebResponse implements IDisposable, but it doesn't have a Dispose method. How is that possible? ...

FtpWebRequest Download File Incorrect Size

I’m using the following code to download a file from a remote ftp server: FtpWebRequest request = (FtpWebRequest)WebRequest.Create(serverPath); request.KeepAlive = true; request.UsePassive = true; request.UseBinary = true; request.Method = WebRequestMethods.Ftp.DownloadFile; request.Cred...