There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Unable to parse the directory list: String was not recognized as a valid DateTime.
I've been testing the AlexFTPS component to do some automated FTP directory synchronization and I wanted something that would support FTPS as well as plain FTP. My initial tests were against a Filezilla server over FTPS and everything works beautifully.
However, my other test server is a Microsoft FTP server (version unknown) using standard FTP.
When I issue a GetDirectoryList() against the appropriate directory, I'm getting an AlexPilotti.FTPS.Common.FTPException with the message "Unable to parse the directory list." with an inner exception of System.FormatException with a message "String
was not recognized as a valid DateTime.
I executed a GetDirectoryListUnparsed() against both servers and compared the date/time strings. The difference is subtle but the Filezilla server returns a date as Feb 08 05:19 and the Microsoft server is returning Feb 8 5:19. Using Reflector and stepping
through code, I see the issue is the extra space between the 8 and the 5. A zero is added in front of the 8 in place of the space but the space in front of the 5 remains and when DateTime.ParseExact is executed with a format of "MMM dd HH:mm", the
exception is thrown.
I just wanted to document this minor issue. I've attached a text file containing the unparsed directory list with an example of the offending date.
For now, I can use GetDirectoryListUnparsed() and write a parsing routine specifically for this server.