Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2006

Tip: Looking for answers? Try searching our database.

FTPWebRequest doing it's own thang

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jay Pondy - 02 Mar 2006 20:38 GMT
The following code to connect to a Stratus VOS system
does not work because as you can see in the trace output
the WebRequest has decided to do it's own thing and issue
a PWD after which it issues a CWD based on the reply.

It is also issuing a "OPTS utf8 on" which I did not ask for.

I am asking for a directory listing in the code so why is it
issuing these other commands and what can be done about it?

---------- Code ----------------
  Sub Main()

       Dim oReader As StreamReader = Nothing
       Dim oRequest As FtpWebRequest = Nothing
       Dim oResponse As FtpWebResponse = Nothing

       Try
           oRequest = WebRequest.Create("ftp://USERNAME:PASSWORD@Majiq")
           oRequest.Method = WebRequestMethods.Ftp.ListDirectory

           oResponse = oRequest.GetResponse
           oReader = New StreamReader(oResponse.GetResponseStream)
           Console.WriteLine(oReader.ReadToEnd)

           Console.WriteLine("-- Mission Accomplished --")

       Catch Ex As WebException
           Console.WriteLine(Ex.ToString)
       Catch ex As Exception
           Console.WriteLine(ex.Message)
       Finally
           Console.ReadLine()
       End Try

   End Sub

------------ Trace Output -------------
System.Net Verbose: 0 : [6124]
WebRequest::Create(ftp://USERNAME:PASSWORD@majiq/)
System.Net Information: 0 : [6124]
FtpWebRequest#39785641::.ctor(ftp://USERNAME:PASSWORD@majiq/)
System.Net Verbose: 0 : [6124] Exiting WebRequest::Create()     ->
FtpWebRequest#39785641
System.Net Verbose: 0 : [6124] FtpWebRequest#39785641::GetResponse()
System.Net Information: 0 : [6124]
FtpWebRequest#39785641::GetResponse(Method=NLST.)
System.Net.Sockets Verbose: 0 : [6124] Socket#45523402::Socket(InterNetwork#2)
System.Net.Sockets Verbose: 0 : [6124] Exiting Socket#45523402::Socket()
System.Net.Sockets Verbose: 0 : [6124]
Socket#45523402::Connect(201:21#-918544865)
System.Net.Sockets Verbose: 0 : [6124] Exiting Socket#45523402::Connect()
System.Net Information: 0 : [6124] Associating FtpWebRequest#39785641 with
FtpControlStream#35287174
System.Net.Sockets Verbose: 0 : [6124] Socket#45523402::Receive()
System.Net.Sockets Verbose: 0 : [6124] Data from Socket#45523402::Receive
System.Net.Sockets Verbose: 0 : [6124] 00000000 : 32 32 30 20 6D 61 6A 69-71
5F 61 70 61 67 20 46 : 220 majiq_apag F
System.Net.Sockets Verbose: 0 : [6124] 00000010 : 54 50 20 73 65 72 76 65-72
20 28 46 54 50 20 31 : TP server (FTP 1
System.Net.Sockets Verbose: 0 : [6124] 00000020 : 2E 30 20 66 6F 72 20 53-74
72 61 74 75 73 20 53 : .0 for Stratus S
System.Net.Sockets Verbose: 0 : [6124] 00000030 : 54 43 50 29 20 72 65 61-64
79 2E 20 28 43 6F 6D : TCP) ready. (Com
System.Net.Sockets Verbose: 0 : [6124] 00000040 : 70 61 74 69 62 6C 65 20-77
69 74 68 20 4F 53 20 : patible with OS
System.Net.Sockets Verbose: 0 : [6124] 00000050 : 54 43 50 2F 49 50 29 0D-0A
                    : TCP/IP)..
System.Net.Sockets Verbose: 0 : [6124] Exiting Socket#45523402::Receive()
    -> 89#89
System.Net Information: 0 : [6124] FtpControlStream#35287174 - Received
response [220 majiq_apag FTP server (FTP 1.0 for Stratus STCP) ready.
(Compatible with OS TCP/IP)]
System.Net Information: 0 : [6124] FtpControlStream#35287174 - Sending
command [USER USERNAME]
System.Net.Sockets Verbose: 0 : [6124] Socket#45523402::Send()
System.Net.Sockets Verbose: 0 : [6124] Data from Socket#45523402::Send
System.Net.Sockets Verbose: 0 : [6124] 00000000 : 55 53 45 52 20 4C 61 62-4E
65 74 0D 0A          : USER USERNAME..
System.Net.Sockets Verbose: 0 : [6124] Exiting Socket#45523402::Send()     ->
13#13
System.Net.Sockets Verbose: 0 : [6124] Socket#45523402::Receive()
System.Net.Sockets Verbose: 0 : [6124] Data from Socket#45523402::Receive
System.Net.Sockets Verbose: 0 : [6124] 00000000 : 33 33 31 20 50 61 73 73-77
6F 72 64 20 72 65 71 : 331 Password req
System.Net.Sockets Verbose: 0 : [6124] 00000010 : 75 69 72 65 64 20 66 6F-72
20 4C 61 62 4E 65 74 : uired for USERNAME
System.Net.Sockets Verbose: 0 : [6124] 00000020 : 2E 0D 0A                  
                    : ...
System.Net.Sockets Verbose: 0 : [6124] Exiting Socket#45523402::Receive()
    -> 35#35
System.Net Information: 0 : [6124] FtpControlStream#35287174 - Received
response [331 Password required for USERNAME.]
System.Net Information: 0 : [6124] FtpControlStream#35287174 - Sending
command [PASS ********]
System.Net.Sockets Verbose: 0 : [6124] Socket#45523402::Send()
System.Net.Sockets Verbose: 0 : [6124] Data from Socket#45523402::Send
System.Net.Sockets Verbose: 0 : [6124] 00000000 : 50 41 53 53 20 68 6F 6D-65
79 0D 0A             : PASS PASSWORD..
System.Net.Sockets Verbose: 0 : [6124] Exiting Socket#45523402::Send()     ->
12#12
System.Net.Sockets Verbose: 0 : [6124] Socket#45523402::Receive()
System.Net.Sockets Verbose: 0 : [6124] Data from Socket#45523402::Receive
System.Net.Sockets Verbose: 0 : [6124] 00000000 : 32 33 30 20 55 73 65 72-20
4C 61 62 4E 65 74 2E : 230 User USERNAME.
System.Net.Sockets Verbose: 0 : [6124] 00000010 : 75 73 65 72 73 20 6C 6F-67
67 65 64 20 69 6E 2E : users logged in.
System.Net.Sockets Verbose: 0 : [6124] 00000020 : 0D 0A                      
                    : ..
System.Net.Sockets Verbose: 0 : [6124] Exiting Socket#45523402::Receive()
    -> 34#34
System.Net Information: 0 : [6124] FtpControlStream#35287174 - Received
response [230 User USERNAME.users logged in.]
System.Net Information: 0 : [6124] FtpControlStream#35287174 - Sending
command [OPTS utf8 on]
System.Net.Sockets Verbose: 0 : [6124] Socket#45523402::Send()
System.Net.Sockets Verbose: 0 : [6124] Data from Socket#45523402::Send
System.Net.Sockets Verbose: 0 : [6124] 00000000 : 4F 50 54 53 20 75 74 66-38
20 6F 6E 0D 0A       : OPTS utf8 on..
System.Net.Sockets Verbose: 0 : [6124] Exiting Socket#45523402::Send()     ->
14#14
System.Net.Sockets Verbose: 0 : [6124] Socket#45523402::Receive()
System.Net.Sockets Verbose: 0 : [6124] Data from Socket#45523402::Receive
System.Net.Sockets Verbose: 0 : [6124] 00000000 : 35 30 30 20 43 6F 6D 6D-61
6E 64 20 6E 6F 74 20 : 500 Command not
System.Net.Sockets Verbose: 0 : [6124] 00000010 : 75 6E 64 65 72 73 74 6F-6F
64 2E 0D 0A          : understood...
System.Net.Sockets Verbose: 0 : [6124] Exiting Socket#45523402::Receive()
    -> 29#29
System.Net Information: 0 : [6124] FtpControlStream#35287174 - Received
response [500 Command not understood.]
System.Net Information: 0 : [6124] FtpControlStream#35287174 - Sending
command [PWD]
System.Net.Sockets Verbose: 0 : [6124] Socket#45523402::Send()
System.Net.Sockets Verbose: 0 : [6124] Data from Socket#45523402::Send
System.Net.Sockets Verbose: 0 : [6124] 00000000 : 50 57 44 0D 0A            
                    : PWD..
System.Net.Sockets Verbose: 0 : [6124] Exiting Socket#45523402::Send()     -> 5#5
System.Net.Sockets Verbose: 0 : [6124] Socket#45523402::Receive()
System.Net.Sockets Verbose: 0 : [6124] Data from Socket#45523402::Receive
System.Net.Sockets Verbose: 0 : [6124] 00000000 : 32 35 37 20 22 25 6D 61-6A
69 71 5F 61 70 61 67 : 257 "%majiq_apag
System.Net.Sockets Verbose: 0 : [6124] 00000010 : 23 64 30 31 3E 75 73 65-72
73 3E 61 70 63 6D 3E : #d01>users>apcm>
System.Net.Sockets Verbose: 0 : [6124] 00000020 : 64 62 3E 70 74 70 3E 69-6E
22 20 69 73 20 63 75 : db>ptp>in" is cu
System.Net.Sockets Verbose: 0 : [6124] 00000030 : 72 72 65 6E 74 20 64 69-72
65 63 74 6F 72 79 2E : rrent directory.
System.Net.Sockets Verbose: 0 : [6124] 00000040 : 0D 0A                      
                    : ..
System.Net.Sockets Verbose: 0 : [6124] Exiting Socket#45523402::Receive()
    -> 66#66
System.Net Information: 0 : [6124] FtpControlStream#35287174 - Received
response [257 "%majiq_apag#d01>users>apcm>db>ptp>in" is current directory.]
System.Net Information: 0 : [6124] FtpControlStream#35287174 - Sending
command [CWD %majiq_apag#d01>users>apcm>db>ptp>in/]
System.Net.Sockets Verbose: 0 : [6124] Socket#45523402::Send()
System.Net.Sockets Verbose: 0 : [6124] Data from Socket#45523402::Send
System.Net.Sockets Verbose: 0 : [6124] 00000000 : 43 57 44 20 25 6D 61 6A-69
71 5F 61 70 61 67 23 : CWD %majiq_apag#
System.Net.Sockets Verbose: 0 : [6124] 00000010 : 64 30 31 3E 75 73 65 72-73
3E 61 70 63 6D 3E 64 : d01>users>apcm>d
System.Net.Sockets Verbose: 0 : [6124] 00000020 : 62 3E 70 74 70 3E 69 6E-2F
0D 0A                : b>ptp>in/..
System.Net.Sockets Verbose: 0 : [6124] Exiting Socket#45523402::Send()     ->
43#43
System.Net.Sockets Verbose: 0 : [6124] Socket#45523402::Receive()
System.Net.Sockets Verbose: 0 : [6124] Data from Socket#45523402::Receive
System.Net.Sockets Verbose: 0 : [6124] 00000000 : 35 35 30 20 25 6D 61 6A-69
71 5F 61 70 61 67 23 : 550 %majiq_apag#
System.Net.Sockets Verbose: 0 : [6124] 00000010 : 64 30 31 3E 75 73 65 72-73
3E 61 70 63 6D 3E 64 : d01>users>apcm>d
System.Net.Sockets Verbose: 0 : [6124] 00000020 : 62 3E 70 74 70 3E 69 6E-2F
3A 20 4E 6F 20 73 75 : b>ptp>in/: No su
System.Net.Sockets Verbose: 0 : [6124] 00000030 : 63 68 20 66 69 6C 65 20-6F
72 20 64 69 72 65 63 : ch file or direc
System.Net.Sockets Verbose: 0 : [6124] 00000040 : 74 6F 72 79 2E 2E 0D 0A-  
                    : tory....
System.Net.Sockets Verbose: 0 : [6124] Exiting Socket#45523402::Receive()
    -> 72#72
System.Net Information: 0 : [6124] FtpControlStream#35287174 - Received
response [550 %majiq_apag#d01>users>apcm>db>ptp>in/: No such file or
directory..]
System.Net.Sockets Verbose: 0 : [6124] Socket#45523402::Dispose()
System.Net Information: 0 : [6124] FtpWebRequest#39785641::(Releasing FTP
connection#35287174.)
System.Net Error: 0 : [6124] Exception in the
FtpWebRequest#39785641::GetResponse - The remote server returned an error:
(550) File unavailable (e.g., file not found, no access).
System.Net Error: 0 : [6124]    at
System.Net.FtpWebRequest.SyncRequestCallback(Object obj)
  at System.Net.FtpWebRequest.RequestCallback(Object obj)
  at System.Net.CommandStream.Abort(Exception e)
  at System.Net.FtpWebRequest.FinishRequestStage(RequestStage stage)
  at System.Net.FtpWebRequest.GetResponse()
System.Net Verbose: 0 : [6124] Exiting FtpWebRequest#39785641::GetResponse()
Jay Pondy - 03 Mar 2006 13:56 GMT
I'd really like some sort of answer to this because at this point I am
writing VBScript code using ADO and the command line version of FTP to
get the job done and it is NOT fun.

>The following code to connect to a Stratus VOS system
>does not work because as you can see in the trace output
[quoted text clipped - 192 lines]
>   at System.Net.FtpWebRequest.GetResponse()
>System.Net Verbose: 0 : [6124] Exiting FtpWebRequest#39785641::GetResponse()

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.