SSL Implicit and Explicit

Jan 31, 2012 at 5:44 PM

Hi !

I'm trying to work with the SSL mode of the ftp client and I have somes questions.

I'm testing with FTP servers that doesn't accept SSL connections, in order to provide feedbacks to my users.

So first questions :

1) When using Explicit SSL, the FTP client sends the commands AUTH SSL and AUTH TLS, in my case the server responds :


500 AUTH not understood

For both AUTH command, which is normal, but it continue to performs the connection and connect to the server without SSL, is there
a way to prevent this behavior ? I'd like to stop the connection when AUTH SSL and AUTH TLS fails.

2) For Implicit SSL It always use the port setted when creating the FtpClient, is it normal that it never tries to connect to 990 ?

Thank you !


Jan 31, 2012 at 6:41 PM

I'll add an event handler for the lack of support for the AUTH command that allows you to control how it proceeds. In regards to port used for connections, yes that is normal. If you want to use a port other than 21 then you need to explicitly set the port you want. I know that the default port for implicit SSL is 990 however I will not add code that has the possibility of overriding a change to a property that was explicitly done outside of the System.Net.FtpClient code, this would be considered a bug. The class is initialized to use port 21, anything else has to be explicitly set so that the behavior remains predictable.

Jan 31, 2012 at 7:32 PM

Alright, this revision...

...has a new SecurityNotAvailable event handler that is fired when the AUTH command fails. The event args has a cancel property, set it to true and it will trigger a FtpCommandException in the internal ConnectionReady event handler which will break the ConnectionReady event chain. I don't have an idea for a more graceful way of canceling the connection without risking breaking other peoples projects built off of code before this revision.

Feb 1, 2012 at 9:14 AM

Thank you very much, I was thinking of doing the same, but I'd prefer ask to you before.