|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
FtpWebRequest doing a CWD in addition to PWD, with extra "/"I am not sure if anyone has encountered the same problem and know the answer... When I set an FtpWebRequest to do PWD with the following code, _FtpWebRequest.Method = WebRequestMethods.Ftp.PrintWorkingDirectory; _FtpWebResponse = (FtpWebResponse)_FtpWebRequest.GetResponse(); the trace showed that FtpWebRequest also does a CWD, as shown in the following trace: System.Net Information: 0 : [3756] FtpControlStream#33163964 - Sending command [PWD] System.Net Information: 0 : [3756] FtpControlStream#33163964 - Received response [257 "*.*/*" is the current directory] System.Net Information: 0 : [3756] FtpControlStream#33163964 - Sending command [CWD *.*/*/] System.Net Information: 0 : [3756] FtpControlStream#33163964 - Received response [550 Invalid directory.] As you can see from the last two lines of trace, the framework performs an CWD with and extra "/" which makes the server throw a 550 error. Another related issue is that the framework seems to treat "*.*/*" in the above example as the root directory so when I specify a remote directory, FtpWebRequest fwr = (FtpWebRequest)WebRequest.Create("ftp://usa.ftptls.edisrvcs.com/GXS.U9999443"); where "GXS.U9999443" is the directory, the trace showed that .NET try to change to the directory under "*.*/*" with a "CWD *.*/*/gxs.u9999443" , instead of just simply change to that directory with the command "CWD gxs.u9999443" thus an error occurs: System.Net Information: 0 : [4352] FtpControlStream#2637164 - Received response [257 "*.*/*" is the current directory] System.Net Information: 0 : [4352] FtpControlStream#2637164 - Sending command [CWD *.*/*/GXS.U9999443] Has anyone encountered the same issue and how did you resolve it? Thanks!!! Eugene By modifying the URI to ftp://usa.ftptls.edisrvcs.com//GXS.U9999443 (note the
extra slash between the server address and the remote directory) I was able to avoid the problem of .NET CWD into *.*/*/gxs.u9999443. However, .NET is still adding an extra slash in front, performing a CWD /EGXS.U9999443 and the server is still throwing me a [550 Invalid directory.]. Does anyone know how I can get .NET to do nothing but a simple [CWD EGXS.U9999443]? Thanks, Eugene Show quote "Eugene" wrote: > Hi, > I am not sure if anyone has encountered the same problem and know the > answer... > > When I set an FtpWebRequest to do PWD with the following code, > _FtpWebRequest.Method = WebRequestMethods.Ftp.PrintWorkingDirectory; > _FtpWebResponse = (FtpWebResponse)_FtpWebRequest.GetResponse(); > > the trace showed that FtpWebRequest also does a CWD, as shown in the > following trace: > > System.Net Information: 0 : [3756] FtpControlStream#33163964 - Sending > command [PWD] > > System.Net Information: 0 : [3756] FtpControlStream#33163964 - Received > response [257 "*.*/*" is the current directory] > > System.Net Information: 0 : [3756] FtpControlStream#33163964 - Sending > command [CWD *.*/*/] > > System.Net Information: 0 : [3756] FtpControlStream#33163964 - Received > response [550 Invalid directory.] > > As you can see from the last two lines of trace, the framework performs an > CWD with and extra "/" which makes the server throw a 550 error. > > Another related issue is that the framework seems to treat "*.*/*" in the > above example as the root directory so when I specify a remote directory, > FtpWebRequest fwr = > (FtpWebRequest)WebRequest.Create("ftp://usa.ftptls.edisrvcs.com/GXS.U9999443"); > where "GXS.U9999443" is the directory, the trace showed that .NET try to > change to the directory under "*.*/*" with a "CWD *.*/*/gxs.u9999443" , > instead of just simply change to that directory with the command "CWD > gxs.u9999443" thus an error occurs: > > System.Net Information: 0 : [4352] FtpControlStream#2637164 - Received > response [257 "*.*/*" is the current directory] > System.Net Information: 0 : [4352] FtpControlStream#2637164 - Sending > command [CWD *.*/*/GXS.U9999443] > > Has anyone encountered the same issue and how did you resolve it? > > Thanks!!! > > Eugene |
|||||||||||||||||||||||