Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
5.9k views
in .NET FTP by (420 points)
Firstly as mentioned in my email, your components are awesome!

Are there any plans to create more meaningful exception handling mechanism? I'm using the Asynchronous functions so that our GUI stays responsive at all times. The FtpException is too generic and I'm thinking I'll have to pass the Message string to get an idea of the error that occured.

Heres an example.

DEBUG: Connecting to mirror.3fl.net.au...
RESPONSE: 220 ProFTPD 1.3.1 Server (3FL Mirror) [::ffff:203.21.20.200]
DEBUG: Logging into mirror.3fl.net.au:21...
COMMAND: ---> USER Anonymous
RESPONSE: 331 Password required for Anonymous
COMMAND: ---> PASS ********
RESPONSE: 530 Login incorrect.
DEBUG: Logged into mirror.3fl.net.au:21...
DEBUG: Closing connection to mirror.3fl.net.au...
COMMAND: ---> QUIT
RESPONSE: 221 Goodbye.
DEBUG: Closed connection to mirror.3fl.net.au...Adios!
DEBUG: Connected to mirror.3fl.net.au...
ERROR: EnterpriseDT.Net.Ftp.FTPException: Login incorrect. (code=530)
   at EnterpriseDT.Net.Ftp.FTPControlSocket.ValidateReply(FTPReply reply, String[] expectedReplyCodes)
   at EnterpriseDT.Net.Ftp.FTPClient.Password(String password)
   at EnterpriseDT.Net.Ftp.FTPConnection.PerformAutoLogin()
   at EnterpriseDT.Net.Ftp.ExFTPConnection.PerformAutoLogin()
   at EnterpriseDT.Net.Ftp.SecureFTPConnection.Connect()
ERROR: BROWSER_EXCEPTION: REMOTE-> Socket_Connected Failed: Login incorrect. (code=530)
EnterpriseDT.Net.Ftp.FTPException: Login incorrect. (code=530)
   at EnterpriseDT.Net.Ftp.ExFTPConnection.a.a()
   at EnterpriseDT.Net.Ftp.ExFTPConnection.EndConnect(IAsyncResult asyncResult)
   at WebSoftware.DevFtp.RemoteExplorerUserControl.Socket_Connected(IAsyncResult ar) in *****


Now I handle that and workout if the (code=***) is 530 to determine what the error was that was raised.

Also I'm getting alot of TargetInvocationException's being raised and I'm looking inside the Inner-Exception... is this by design as I assumed (and you know what they say about that!) when we call End<MethodName> they throw the raw exception to handle.

3 Answers

0 votes
by (162k points)
The TargetInvocationExceptions are the result of a bug (the real exception is in this exception). If you email us we'll send you a link to a patched DLL to try out.

Unfortunately on the "meaningful exception" side of things, we are a bit constrained. FTP servers don't use error codes consistently at all, so there isn't really any generic way of categorizing the different errors that can arise. However the FTPException does have the error code sent by the server included (but as I've said, these aren't consistently used). e.g. not all servers will return 530 for an incorrect login.
0 votes
by (420 points)
*doh* totally understood and I just realised there was a ReplyCode member in the exception :)
0 votes
by (420 points)
The TargetInvocationExceptions are the result of a bug (the real exception is in this exception). If you email us we'll send you a link to a patched DLL to try out.


Works great thanks!

Categories

...