G
Guest
Hi
I'm having a lot of problems with the FtpWebRequest object in the RTM
release of .Net 2.0
I'm trying to upload a file to a unix based system. However it fails from
code while regular ftp clients can complete the command fine
including the ftp command line.
I've compiled trace of the ftp connections from both the code and client,
connecting to both a Microsoft Ftp Server and my target system.
The traces are included below
From the traces it appears the FtpWebRequest object is trying to issue a CWD
command which results in an error, "550 Expected a comma or
a semicolon. (CIERR 10125)".
Please can someone help in identifying a way round this, i'm not sure why
the CWD command is issued as the client does not issue this
command.
Thanks in advance,
stockwep
Trace from FtpWebRequest when connecting to target system
---------------------------------------------------------
System.Net Verbose: 0 : [0812] WebRequest::Create(ftp://xxx.xxx.xxx.xx/)
System.Net Information: 0 : [0812]
FtpWebRequest#20688614::.ctor(ftp://xxx.xxx.xxx.xx/)
System.Net Verbose: 0 : [0812] Exiting WebRequest::Create() ->
FtpWebRequest#20688614
System.Net Verbose: 0 : [0812] FtpWebRequest#20688614::GetResponse()
System.Net Information: 0 : [0812]
FtpWebRequest#20688614::GetResponse(Method=PWD.)
System.Net Information: 0 : [0812] Associating FtpWebRequest#20688614 with
FtpControlStream#49519450
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Received
response [220 HP ARPA FTP Server [A0012D07] (C) Hewlett-Packard
Co. 2000 [PASV SUPPORT]]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Sending
command [USER USR.TEST]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Received
response [331 Password required for **************. Syntax:
userpass,acctpass]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Sending
command [PASS ********]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Received
response [230 User logged on]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Sending
command [OPTS utf8 on]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Received
response [500 'OPTS': unknown command.]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Sending
command [PWD]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Received
response [257-"/TEST/RM" is the current directory.
257 "USR.TEST,RM" is the current session.]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Sending
command [CWD /TEST/RM" is the current directory.
257 "USR.TEST,RM/]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Received
response [550 Expected a comma or a semicolon. (CIERR 10125)]
System.Net Information: 0 : [0812] FtpWebRequest#20688614:Releasing FTP
connection#49519450.)
System.Net Error: 0 : [0812] Exception in the
FtpWebRequest#20688614::GetResponse - The remote server returned an error:
(550) File
unavailable (e.g., file not found, no access).
System.Net Error: 0 : [0812] at System.Net.FtpWebRequest.CheckError()
at System.Net.FtpWebRequest.SyncRequestCallback(Object obj)
at System.Net.FtpWebRequest.RequestCallback(Object obj)
at System.Net.CommandStream.InvokeRequestCallback(Object obj)
at System.Net.CommandStream.Abort(Exception e)
at System.Net.FtpWebRequest.FinishRequestStage(RequestStage stage)
at System.Net.FtpWebRequest.GetResponse()
A first chance exception of type 'System.Net.WebException' occurred in
System.dll
System.Net Verbose: 0 : [0812] Exiting FtpWebRequest#20688614::GetResponse()
Trace from Filezilla when connecting to target system
-----------------------------------------------------
Status: Connecting to xxx.xxx.xxx.xx ...
Status: Connected with xxx.xxx.xxx.xx. Waiting for welcome message...
Response: 220 HP ARPA FTP Server [A0012D07] (C) Hewlett-Packard Co. 2000
[PASV SUPPORT]
Command: USER USR.TEST
Response: 331 Password required for USR.TEST. Syntax: userpass,acctpass
Command: PASS ***************
Response: 230 User logged on
Command: FEAT
Response: 500 'FEAT': unknown command.
Command: SYST
Response: 215 MPE/iX LF system type.
Status: Connected
Status: Retrieving directory listing...
Command: PWD
Response: 257-"/TEST/RM" is the current directory.
Response: 257 "USR.TEST,RM" is the current session.
Command: TYPE A
Response: 200 Type set to A.
Command: PASV
Response: 227 Entering Passive Mode (xxx,xxx,xxx,xx,251,80)
Command: LIST
Response: 150 File: LISTFILE ./@,2 opened; data connection will be opened
Response: 226 Transfer complete.
Status: Directory listing successful
Status: Starting upload of file.txt
Command: TYPE A
Response: 200 Type set to A.
Command: PASV
Response: 227 Entering Passive Mode (xxx,xxx,xxx,xx,251,83)
Command: STOR auupdate
Response: 150 File: auupdate opened; data connection will be opened
Response: 226 Transfer complete.
Status: Upload successful
Status: Retrieving directory listing...
Command: TYPE A
Response: 200 Type set to A.
Command: PASV
Response: 227 Entering Passive Mode (xxx,xxx,xxx,xx,251,84)
Command: LIST
Response: 150 File: LISTFILE ./@,2 opened; data connection will be opened
Response: 226 Transfer complete.
Status: Directory listing successful
Trace from FtpWebRequest when connecting to Microsoft Ftp Server
----------------------------------------------------------------
System.Net Verbose: 0 : [2340] WebRequest::Create(ftp://xxxxxx/file)
System.Net Information: 0 : [2340]
FtpWebRequest#20688614::.ctor(ftp://xxxxxx/file)
System.Net Verbose: 0 : [2340] Exiting WebRequest::Create() ->
FtpWebRequest#20688614
System.Net Verbose: 0 : [2340] FtpWebRequest#20688614::GetRequestStream()
System.Net Information: 0 : [2340]
FtpWebRequest#20688614::GetRequestStream(Method=STOR.)
System.Net Information: 0 : [2340] Associating FtpWebRequest#20688614 with
FtpControlStream#49519450
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [220 Microsoft FTP Service]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [USER USR.TEST]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [331 Password required for USR.TEST.]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [PASS ********]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [230 User USR.TEST logged in.]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [OPTS utf8 on]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [501 option not supported]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [PWD]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [257 "/USR.TEST" is current directory.]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [CWD /USR.TEST/]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [250 CWD command successful.]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [TYPE A]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [200 Type set to A.]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [PASV]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [227 Entering Passive Mode (xx,x,xx,xxx,x,xx).]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [STOR auupdate]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [125 Data connection already open; Transfer starting.]
System.Net Verbose: 0 : [2340] Exiting
FtpWebRequest#20688614::GetRequestStream()
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [226 Transfer complete.]
System.Net Information: 0 : [2340] FtpWebRequest#20688614:Releasing FTP
connection#49519450.)
System.Net Verbose: 0 : [2340] FtpWebRequest#20688614::GetResponse()
System.Net Information: 0 : [2340]
FtpWebRequest#20688614::GetResponse(Method=STOR.)
System.Net Verbose: 0 : [2340] Exiting FtpWebRequest#20688614::GetResponse()
System.Net Verbose: 0 : [2340]
WebRequest::Create(ftp://babyecommerce0/auupdate)
System.Net Information: 0 : [2340]
FtpWebRequest#54901306::.ctor(ftp://babyecommerce0/auupdate)
System.Net Verbose: 0 : [2340] Exiting WebRequest::Create() ->
FtpWebRequest#54901306
System.Net Verbose: 0 : [2340] FtpWebRequest#54901306::GetResponse()
System.Net Information: 0 : [2340]
FtpWebRequest#54901306::GetResponse(Method=MDTM.)
System.Net Information: 0 : [2340] Associating FtpWebRequest#54901306 with
FtpControlStream#49519450
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [MDTM auupdate]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [213 20060209092410]
System.Net Information: 0 : [2340] FtpWebRequest#54901306:Releasing FTP
connection#49519450.)
System.Net Verbose: 0 : [2340] Exiting FtpWebRequest#54901306::GetResponse()
System.Net Verbose: 0 : [2340] FtpWebResponse#66651065::Close()
System.Net Verbose: 0 : [2340] Exiting FtpWebResponse#66651065::Close()
The thread 0x924 has exited with code 0 (0x0).
The thread 0x494 has exited with code 0 (0x0).
The thread 0xb74 has exited with code 0 (0x0).
The thread 0xd0c has exited with code 0 (0x0).
The thread 0xb88 has exited with code 0 (0x0).
The thread 0xfe4 has exited with code 0 (0x0).
The program '[4056] vstesthost.exe: Managed' has exited with code 0 (0x0).
The program '[2236] SmartFareClient.vshost.exe: Managed' has exited with
code 0 (0x0).
Trace from Filezilla when connecting to Microsoft Ftp Server
----------------------------------------------------------------
Status: Connecting to xxxx ...
Status: Connected with xxxx. Waiting for welcome message...
Response: 220 Microsoft FTP Service
Command: USER USR.TEST
Response: 331 Password required for ftpmax.testdww.
Command: PASS ***************
Response: 230 User USR.TEST logged in.
Command: FEAT
Response: 211-FEAT
Response: SIZE
Response: MDTM
Response: 211 END
Command: SYST
Response: 215 Windows_NT
Status: Connected
Status: Retrieving directory listing...
Command: PWD
Response: 257 "/USR.TEST" is current directory.
Status: Directory listing successful
Status: Starting upload of C:\file.txt
Command: TYPE A
Response: 200 Type set to A.
Command: PASV
Response: 227 Entering Passive Mode (xx,x,xx,xxx,4,43).
Command: STOR auupdate
Response: 125 Data connection already open; Transfer starting.
Response: 226 Transfer complete.
Status: Upload successful
Status: Retrieving directory listing...
Command: TYPE A
Response: 200 Type set to A.
Command: PASV
Response: 227 Entering Passive Mode (xx,xx,xx,xx,4,44).
Command: LIST
Response: 125 Data connection already open; Transfer starting.
Response: 226 Transfer complete.
Status: Directory listing successful
I'm having a lot of problems with the FtpWebRequest object in the RTM
release of .Net 2.0
I'm trying to upload a file to a unix based system. However it fails from
code while regular ftp clients can complete the command fine
including the ftp command line.
I've compiled trace of the ftp connections from both the code and client,
connecting to both a Microsoft Ftp Server and my target system.
The traces are included below
From the traces it appears the FtpWebRequest object is trying to issue a CWD
command which results in an error, "550 Expected a comma or
a semicolon. (CIERR 10125)".
Please can someone help in identifying a way round this, i'm not sure why
the CWD command is issued as the client does not issue this
command.
Thanks in advance,
stockwep
Trace from FtpWebRequest when connecting to target system
---------------------------------------------------------
System.Net Verbose: 0 : [0812] WebRequest::Create(ftp://xxx.xxx.xxx.xx/)
System.Net Information: 0 : [0812]
FtpWebRequest#20688614::.ctor(ftp://xxx.xxx.xxx.xx/)
System.Net Verbose: 0 : [0812] Exiting WebRequest::Create() ->
FtpWebRequest#20688614
System.Net Verbose: 0 : [0812] FtpWebRequest#20688614::GetResponse()
System.Net Information: 0 : [0812]
FtpWebRequest#20688614::GetResponse(Method=PWD.)
System.Net Information: 0 : [0812] Associating FtpWebRequest#20688614 with
FtpControlStream#49519450
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Received
response [220 HP ARPA FTP Server [A0012D07] (C) Hewlett-Packard
Co. 2000 [PASV SUPPORT]]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Sending
command [USER USR.TEST]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Received
response [331 Password required for **************. Syntax:
userpass,acctpass]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Sending
command [PASS ********]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Received
response [230 User logged on]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Sending
command [OPTS utf8 on]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Received
response [500 'OPTS': unknown command.]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Sending
command [PWD]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Received
response [257-"/TEST/RM" is the current directory.
257 "USR.TEST,RM" is the current session.]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Sending
command [CWD /TEST/RM" is the current directory.
257 "USR.TEST,RM/]
System.Net Information: 0 : [0812] FtpControlStream#49519450 - Received
response [550 Expected a comma or a semicolon. (CIERR 10125)]
System.Net Information: 0 : [0812] FtpWebRequest#20688614:Releasing FTP
connection#49519450.)
System.Net Error: 0 : [0812] Exception in the
FtpWebRequest#20688614::GetResponse - The remote server returned an error:
(550) File
unavailable (e.g., file not found, no access).
System.Net Error: 0 : [0812] at System.Net.FtpWebRequest.CheckError()
at System.Net.FtpWebRequest.SyncRequestCallback(Object obj)
at System.Net.FtpWebRequest.RequestCallback(Object obj)
at System.Net.CommandStream.InvokeRequestCallback(Object obj)
at System.Net.CommandStream.Abort(Exception e)
at System.Net.FtpWebRequest.FinishRequestStage(RequestStage stage)
at System.Net.FtpWebRequest.GetResponse()
A first chance exception of type 'System.Net.WebException' occurred in
System.dll
System.Net Verbose: 0 : [0812] Exiting FtpWebRequest#20688614::GetResponse()
Trace from Filezilla when connecting to target system
-----------------------------------------------------
Status: Connecting to xxx.xxx.xxx.xx ...
Status: Connected with xxx.xxx.xxx.xx. Waiting for welcome message...
Response: 220 HP ARPA FTP Server [A0012D07] (C) Hewlett-Packard Co. 2000
[PASV SUPPORT]
Command: USER USR.TEST
Response: 331 Password required for USR.TEST. Syntax: userpass,acctpass
Command: PASS ***************
Response: 230 User logged on
Command: FEAT
Response: 500 'FEAT': unknown command.
Command: SYST
Response: 215 MPE/iX LF system type.
Status: Connected
Status: Retrieving directory listing...
Command: PWD
Response: 257-"/TEST/RM" is the current directory.
Response: 257 "USR.TEST,RM" is the current session.
Command: TYPE A
Response: 200 Type set to A.
Command: PASV
Response: 227 Entering Passive Mode (xxx,xxx,xxx,xx,251,80)
Command: LIST
Response: 150 File: LISTFILE ./@,2 opened; data connection will be opened
Response: 226 Transfer complete.
Status: Directory listing successful
Status: Starting upload of file.txt
Command: TYPE A
Response: 200 Type set to A.
Command: PASV
Response: 227 Entering Passive Mode (xxx,xxx,xxx,xx,251,83)
Command: STOR auupdate
Response: 150 File: auupdate opened; data connection will be opened
Response: 226 Transfer complete.
Status: Upload successful
Status: Retrieving directory listing...
Command: TYPE A
Response: 200 Type set to A.
Command: PASV
Response: 227 Entering Passive Mode (xxx,xxx,xxx,xx,251,84)
Command: LIST
Response: 150 File: LISTFILE ./@,2 opened; data connection will be opened
Response: 226 Transfer complete.
Status: Directory listing successful
Trace from FtpWebRequest when connecting to Microsoft Ftp Server
----------------------------------------------------------------
System.Net Verbose: 0 : [2340] WebRequest::Create(ftp://xxxxxx/file)
System.Net Information: 0 : [2340]
FtpWebRequest#20688614::.ctor(ftp://xxxxxx/file)
System.Net Verbose: 0 : [2340] Exiting WebRequest::Create() ->
FtpWebRequest#20688614
System.Net Verbose: 0 : [2340] FtpWebRequest#20688614::GetRequestStream()
System.Net Information: 0 : [2340]
FtpWebRequest#20688614::GetRequestStream(Method=STOR.)
System.Net Information: 0 : [2340] Associating FtpWebRequest#20688614 with
FtpControlStream#49519450
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [220 Microsoft FTP Service]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [USER USR.TEST]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [331 Password required for USR.TEST.]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [PASS ********]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [230 User USR.TEST logged in.]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [OPTS utf8 on]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [501 option not supported]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [PWD]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [257 "/USR.TEST" is current directory.]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [CWD /USR.TEST/]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [250 CWD command successful.]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [TYPE A]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [200 Type set to A.]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [PASV]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [227 Entering Passive Mode (xx,x,xx,xxx,x,xx).]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [STOR auupdate]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [125 Data connection already open; Transfer starting.]
System.Net Verbose: 0 : [2340] Exiting
FtpWebRequest#20688614::GetRequestStream()
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [226 Transfer complete.]
System.Net Information: 0 : [2340] FtpWebRequest#20688614:Releasing FTP
connection#49519450.)
System.Net Verbose: 0 : [2340] FtpWebRequest#20688614::GetResponse()
System.Net Information: 0 : [2340]
FtpWebRequest#20688614::GetResponse(Method=STOR.)
System.Net Verbose: 0 : [2340] Exiting FtpWebRequest#20688614::GetResponse()
System.Net Verbose: 0 : [2340]
WebRequest::Create(ftp://babyecommerce0/auupdate)
System.Net Information: 0 : [2340]
FtpWebRequest#54901306::.ctor(ftp://babyecommerce0/auupdate)
System.Net Verbose: 0 : [2340] Exiting WebRequest::Create() ->
FtpWebRequest#54901306
System.Net Verbose: 0 : [2340] FtpWebRequest#54901306::GetResponse()
System.Net Information: 0 : [2340]
FtpWebRequest#54901306::GetResponse(Method=MDTM.)
System.Net Information: 0 : [2340] Associating FtpWebRequest#54901306 with
FtpControlStream#49519450
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Sending
command [MDTM auupdate]
System.Net Information: 0 : [2340] FtpControlStream#49519450 - Received
response [213 20060209092410]
System.Net Information: 0 : [2340] FtpWebRequest#54901306:Releasing FTP
connection#49519450.)
System.Net Verbose: 0 : [2340] Exiting FtpWebRequest#54901306::GetResponse()
System.Net Verbose: 0 : [2340] FtpWebResponse#66651065::Close()
System.Net Verbose: 0 : [2340] Exiting FtpWebResponse#66651065::Close()
The thread 0x924 has exited with code 0 (0x0).
The thread 0x494 has exited with code 0 (0x0).
The thread 0xb74 has exited with code 0 (0x0).
The thread 0xd0c has exited with code 0 (0x0).
The thread 0xb88 has exited with code 0 (0x0).
The thread 0xfe4 has exited with code 0 (0x0).
The program '[4056] vstesthost.exe: Managed' has exited with code 0 (0x0).
The program '[2236] SmartFareClient.vshost.exe: Managed' has exited with
code 0 (0x0).
Trace from Filezilla when connecting to Microsoft Ftp Server
----------------------------------------------------------------
Status: Connecting to xxxx ...
Status: Connected with xxxx. Waiting for welcome message...
Response: 220 Microsoft FTP Service
Command: USER USR.TEST
Response: 331 Password required for ftpmax.testdww.
Command: PASS ***************
Response: 230 User USR.TEST logged in.
Command: FEAT
Response: 211-FEAT
Response: SIZE
Response: MDTM
Response: 211 END
Command: SYST
Response: 215 Windows_NT
Status: Connected
Status: Retrieving directory listing...
Command: PWD
Response: 257 "/USR.TEST" is current directory.
Status: Directory listing successful
Status: Starting upload of C:\file.txt
Command: TYPE A
Response: 200 Type set to A.
Command: PASV
Response: 227 Entering Passive Mode (xx,x,xx,xxx,4,43).
Command: STOR auupdate
Response: 125 Data connection already open; Transfer starting.
Response: 226 Transfer complete.
Status: Upload successful
Status: Retrieving directory listing...
Command: TYPE A
Response: 200 Type set to A.
Command: PASV
Response: 227 Entering Passive Mode (xx,xx,xx,xx,4,44).
Command: LIST
Response: 125 Data connection already open; Transfer starting.
Response: 226 Transfer complete.
Status: Directory listing successful