specifying working directory in FtpClient.Host property

Mar 21, 2016 at 7:51 PM
I would like to be able to say:
//ip addresss and then directory

However, the only way I've been able to do it is by connecting to only the ip address. Then doing FtpClient.SetWorkingDirectory("/MyDir");

I would prefer to not have to do it this way, as I don't want to have two properties (host and directory) in my metadata that represents the connection point . Currently I have one connection point string. Is there a way to do it in one line?

Mar 22, 2016 at 1:41 AM
Use the Connect() static methods that accept a URI or write your own parser. There's no reason System.Net.FtpClient should be parsing what you assign to the Host property. That property is the hostname, it's not anything else and won't be. This is logic you can handle elsewhere in your application.
Mar 22, 2016 at 2:57 PM
Thanks for the stern advice. I agree and have dealt with it.