FTP classes in .NET 2.0

I had a chance to play around with the FTP classes in .NET 2.0 (FtpWebRequest and FtpWebResponse).  My initial impression (after about 15 or 20 minutes of coding) is, yuck — not very good.

First off, as Justin Rogers pointed out two years ago in the betas, they’ve wrapped a stateful protocol into the existing, stateless WebRequest model.  Very wierd design, in my opinion.  Second, the FtpWebRequest has a “Method” property that allows you to set the command you want to send to the FTP server.  There’s a bunch of predefined ones in the WebRequestMethods.Ftp class, but the documentation seems to imply you can enter whatever you want (its just a string).  Since I didn’t see a “CD” command in WebRequestMethods.Ftp I just hard-coded “cd /htdocs” in my test app.  BZZZZT!!  ArgumentException — This method is not supported.  Huh?  How the heck do I change to a different directory??!

After some googling I found this link from Mariya Atanasova’s blog on MSDN.  Wow.  That’s what I need to do to get to a different directory?  Ugly (IMHO).

Ok, since the FTP classes are new in 2.0 I’ll mark this down as a bad experience with the “first version”. 

1 Comment

Comments have been disabled for this content.