FTP Error 125


A

Alan Gillott

I have the following code (stolen from VB2005 with Net 3.0)
I've tried to get help here before but I think I need somewhere with a
better understanding of FTP with .Net but I can't for the life of me find a
more applicable forum. Can anyone direct me accordingly?:

Private Function DoFTPRequest(ByVal url As String, ByVal method As String,
ByVal usebinary As Boolean, ByRef data As stream) As FtpStatusCode
'Imports System.Net These are just comments to remind me what to
import if I copy this routine elsewhere
'Imports System.IO
Dim result As FtpStatusCode
Dim req As FtpWebRequest
Dim resp As FtpWebResponse
Dim creds As New NetworkCredential("anonymous", "(e-mail address removed)")
creds.UserName = "anonymous" 'For testing
creds.Password = "(e-mail address removed)"
req = DirectCast(WebRequest.Create(url), FtpWebRequest)
With req
''''''.Credentials = creds
.UseBinary = usebinary
.UsePassive = True
.KeepAlive = True
'.Method = method
.Method = "LIST"
resp = .GetResponse() <=== This gives me
FTPStatuscode.dataAlreadyOpen (125)
'Pathetic attempt to see if it goes away...
Do While resp.StatusCode = FtpStatusCode.DataAlreadyOpen
System.Threading.Thread.Sleep(1000)
resp = .GetResponse()
Loop
data = resp.GetResponseStream
result = resp.StatusCode
End With
Return result
End Function
 
Ad

Advertisements

A

Alan Gillott

Ok, i'm not used to not errors not being 0. thanks, i'll move on to the next
bit. wouldn't life be peachy if there were adequate documentation...
A
 
Ad

Advertisements

A

Alan Gillott

Thank you Steve. I screwed my courage to the sticking post and implemented
the rest of the code and Lo and Behold I got a directory listing. Not in the
format the Author claimed, but at least I can now implement the real
functionality. Oh, and some bullet proof error recovery - curiously, I was
disturbed to find some of the errors give exceptions instead of status
codes! MSs ftp site was offline yeterday and I got an exception - I was
quite miffed. what's the point in having status codes if you intercept some
of them and create exceptions?
A
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top