Questions tagged [ftpwebresponse]

A .NET Framework class, representing a response from FTP server, used by FtpWebRequest

Documentation: https://msdn.microsoft.com/en-us/library/system.net.ftpwebresponse.aspx

43 questions
44
votes
8 answers

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 =…
Paul Michaels
  • 16,185
  • 43
  • 146
  • 269
20
votes
1 answer

Status Code from FTPWebRequest.GetResponse() method

This is slightly tricky. I am uploading files to FTP asynchronously. After uploading each file I am checking the status of the upload operation for that file. This can be done with StatusCode property of the FtpWebResponse object for that…
Nishant
  • 905
  • 1
  • 16
  • 36
12
votes
2 answers

Connecting ftp server with credentials

I'm writing a program that uses an ftp server with credentials. I'm trying to retrieve the directory list from the server but when I get to the line: string line = reader.ReadLine(); the string that I get contains only : "Can't open…
Shlomit
  • 129
  • 1
  • 1
  • 4
7
votes
3 answers

Extracting file names from WebRequestMethods.Ftp.ListDirectoryDetails

I have an application that does the following: directory listing, download file, download all. I have an issue with getting the file names from WebRequestMethods.Ftp.ListDirectoryDetails. It seems that it is not possible to do so for every…
Mido
  • 452
  • 1
  • 4
  • 13
7
votes
1 answer

FtpWebResponse, the operation timed out

I want to download files based on their date time from a ftp server..I can access this Ftp from CuteFtp third party and every thing is Okey..but when I run the code below at line GetRespone() I get this error: the operation has timed out. I…
Paridokht
  • 1,374
  • 6
  • 20
  • 45
6
votes
2 answers

Program hangs on FtpWebResponse

First time poster, long-time reader. I have a really annoying problem thats been getting on my nerves. Ive got a program set up so I listen for new files on an FTP server, if theres a new file I download it. From there I work on some of the…
MartinNielsen
  • 113
  • 1
  • 2
  • 8
5
votes
1 answer

FTP special character in password?

I am trying to login to a ftp server. Using the following code in C#. FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://ftp-server"); request.Method = WebRequestMethods.Ftp.ListDirectoryDetails; // This example assumes the FTP site…
Amitabh
  • 59,111
  • 42
  • 110
  • 159
5
votes
2 answers

Using FTP to download each file *WHILE* getting the file list

We need to get about 100 very small files from a remote FTP server using vb.net. Our company won't let us buy (or install) any 3rd party ftp libraries... so we are forced to use something like FtpWebRequest. (Or is there a better free, choice that…
Bonnie
  • 161
  • 1
  • 3
  • 6
5
votes
5 answers

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?
MCS
  • 22,113
  • 20
  • 62
  • 76
4
votes
3 answers

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…
jaywon
  • 8,164
  • 10
  • 39
  • 47
3
votes
1 answer

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 =…
Paul Michaels
  • 16,185
  • 43
  • 146
  • 269
3
votes
1 answer

Does the FtpWebResponse IDisposable close the response?

I'm using the following code in my program, would I still need to call response.close()? Or does the FtpWebResponse IDisposable implementation close the response? using (FtpWebResponse response = (FtpWebResponse)request.GetResponse()) { } So…
naed21
  • 147
  • 3
  • 9
2
votes
3 answers

Unit testing FTPWebRequest/FTpWebResponse

How would you unit test FTPWebRequest and FTPWebResponse through MOQ.
Dev-Mo
  • 43
  • 5
2
votes
0 answers

Read FTP file from Azure VM or Azure WebJob

I have created a console application which reads a CSV file from FTP server and dump the records after validation to database. When I tried the code from my local machine, its working perfectly. No errors, no bugs. But when I put it on a Azure…
2
votes
2 answers

How can I create a WebException with an FtpWebResponse for testing?

I'm using FtpWebRequest and a Transient Fault Handling application block. For my fault handler, I have an error detection strategy that checks if the response is considered transient so that it knows whether or not to retry: public bool…
Kai
  • 147
  • 1
  • 13
1
2 3