Re: ftp connection in VB.NET

From: Schoo (scott.schuman_at_nospam.ma-hc.com)
Date: 06/24/04


Date: Thu, 24 Jun 2004 16:14:56 -0500

Peter,
I appologize if there was a miscommunication... I know this thread is
getting long, so let me reiterate the issue, taking a step back to explain
where I am.

I downloaded the samples off the Microsoft KB#812404, so if you have not
already done so, please start with those. I then modified the files as you
recommended on 6/15/04. In the ftp.vb file (from the KB example) there is a
variable to define ftp.currentdirectory. This appears to be the location of
your "directoryname" variable. As I have stated, I have been changing this
to different values including "", "/" and "\", in an attempt to access a
directory listing of the base directory. None of these are working. I am
attaching an updated output file to the end of this message for your review
as the other one is old. Please let me know if you can tell me anything
based on this output..

The goal here is to return a list of all the files and directories in an FTP
site on one of my servers. I can get the file list by typing ftp://
Address> into the address bar in IE6, so I know the site is configured
properly. What I need now is to get the list of directories and files
through code.

Scott

Here is the output (IP Address changed for security reasons):
=======================================================
USER anonymous

331 Anonymous access allowed, send identity (e-mail name) as password.

___ RESPONSE IS COMPLETE
PASS User@

230 Anonymous user logged in.

___ RESPONSE IS COMPLETE
TYPE I

200 Type set to I.

___ RESPONSE IS COMPLETE
 /

500 ' /': command not understood

___ RESPONSE IS COMPLETE
FtpWebRequest::ctor(
ftp://1.5.1.1/)
USER anonymous

331 Anonymous access allowed, send identity (e-mail name) as password.

___ RESPONSE IS COMPLETE
PASS User@

230 Anonymous user logged in.

___ RESPONSE IS COMPLETE
PORT 128,5,252,30,14,42

200 PORT command successful.

___ RESPONSE IS COMPLETE
TYPE I

200 Type set to I.

___ RESPONSE IS COMPLETE
LIST .

150 Opening BINARY mode data connection for /bin/ls.

___ RESPONSE IS COMPLETE
226 Transfer complete.

___ RESPONSE IS COMPLETE
=======================================================

""Peter Huang"" <v-phuang@online.microsoft.com> wrote in message
news:egHt2PMWEHA.2980@cpmsftngxa10.phx.gbl...
> Hi Schoo,
>
> From the information you post before, it seems that we can not enter the
> directory named "directoryname"
>
> CWD \directoryname
>
> 550 /directoryname: The system cannot find the file specified.
>
> In the ftp session, "cwd \directoryname" means "cd \directoryname" in the
> command dos prompt.
> As I said before, I use the directoryname for test only, the directory may
> not exist on your ftp server's root directory.
> e.g.
> If I am sure there is a mailroot directory in the root directory on my ftp
> server, then the cwd \directoryname will success, and now current
directory
> will be \mailroot.
>
> Also because the difference between different ftp server, so you may also
> try to run the command as cwd /directoryname.
> So now we can try to change the code below
> ' this will let us enter the directory CurrentDirectory,
> If Not CurrentDirectory = "" Then
> SendCommand("CWD", "\" + CurrentDirectory)
> resp_desc = ReceiveCommandResponse()
> End If
> AS
> ' this will let us enter the directory CurrentDirectory,
> If Not CurrentDirectory = "" Then
> SendCommand("CWD", "/" + CurrentDirectory)
> resp_desc = ReceiveCommandResponse()
> End If
>
>
> In the main function, we can change the CurrentDirectory as below
> ftp.CurrentDirectory = "subdir1/subdir2"
>
> So that now the cwd command will execute as below
> cwd /subdir1/subdir2
>
> For detailed information, I think you may need to look into the ftp RFC
doc
> for reference about the ftp command.
> FILE TRANSFER PROTOCOL (FTP)
> ftp://ftp.rfc-editor.org/in-notes/rfc959.txt
>
> Best regards,
>
> Peter Huang
> Microsoft Online Partner Support
>
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>



Relevant Pages

  • Re: libfetch ftp patch for less latency
    ... This might be a DOS ftp server thing however. ... there is an error to the all-in-one CWD, the code reverts back to legacy ... Also, considering the reply codes to the CWD command, only 421 seems to ...
    (freebsd-current)
  • Re: LWP::Simple getstore with absolute path not working
    ... That's how FTP URIs are supposed to work. ... | argument to a CWD command. ... Connect to host and log in as anonymous. ...
    (comp.lang.perl.misc)
  • Re: ftp connection in VB.NET
    ... If I am sure there is a mailroot directory in the root directory on my ftp ... try to run the command as cwd /directoryname. ... ' this will let us enter the directory CurrentDirectory, ...
    (microsoft.public.dotnet.framework)
  • Re: FTP From Integrated projects
    ... CWD in some FTPs is the command 'Change Working Directory', which is accomplished in most FTPs by CD; including the HP3000 FTP and the Microsoft FTP running on my Windows XP PC. ... However, a 'Remotehelp' in this session reveals that CWD is a command supported on the remote server, and CD isn't. ...
    (comp.sys.hp.mpe)
  • Re: FTP problems continued
    ... > Below is the code for the whole page: When try to execute it, ... look at the response, e.g.: ... fputs($fp, "cwd somedir"); ... you are sending the cwd command before you have authenicated ...
    (alt.php)

Quantcast