Re: Annoying FTP exception
I checked the WebRequest.Create() method with that URI on my on machine and it worked fine... weird! That 'The handle is invalid' message seems kind of strange. Have you inspected the InnerException property to see what that's all about?
Re: Annoying FTP exception
Turn the Keep Alive off.
Code:
FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(ftpfullpath);
ftp.KeepAlive = false;
According to FtpWebRequest.KeepAlive property in msdn...
Quote:
Gets or sets a Boolean value that specifies whether the control connection to the FTP server is closed after the request completes.
What I believe is going on is that the ftp server keeps the connection alive after the ftp variable has gone out of scope. The error is because the 'ftp' instance isn't around anymore and the ftp service tries to ping the instance (as part of its keep alive functionality).
Re: Annoying FTP exception
It is indeed weird. The only thing I get in the exception is that "the handle is invald" whatever handle that may be.
I get the exception in the Create() call, so disabling KeepAlive won't change anything as the exception is thrown in the previous line.
The really weird thing is, that this has worked previously. I'm starting to wonder if it really is some (sub) DLL that it can't load, and thus can't get a handle to...
Re: Annoying FTP exception
Hm...apparently it helped to re-add System.Net, kill my resharper cache and then recompile everything.
Sorry for disturbing the peace on the forum for this. Now all I have to deal with is that it whines about my filename not being correct. For some reason it now gives me a 553 File name not allowed :-/