Getting "The requested name is valid, but no data of the requested type was found" error

Aug 20, 2012 at 6:31 PM
Edited Aug 20, 2012 at 6:35 PM

Hello,

 I am getting "The requested name is valid, but no data of the requested type was found" when trying to connect to my Ftp server. Below is my code when connecting:

 

using (FtpClient ftp = new FtpClient(_UserName, _Password, _ServerUrl)) {
                ftp.FtpLogStream = Console.OpenStandardOutput();
                // flush the output buffer so that the transaction
                // stays in sync with out output going to screen
                ftp.FtpLogFlushOnWrite = true;

                //////
                // SSL/TLS configuration
                // If you're going to use encryption you should handle the 2 events
                // below according to your needs. It's not uncommon for a server to
                // have a self signed certificate or name mismatch so at the very least
                // you should handle the InvalidCertificate event.
                //////
                // default, use AUTH command to setup encryption
                ftp.SslMode = FtpSslMode.Explicit;
                
                // If you do not handle this event and the AUTH command fails the
                // login credentials will be sent in plain text!!!! See the event args
                // for this event handler.
                ftp.SecurityNotAvailable += new SecurityNotAvailable(OnSecurityNotAvailable);
                ftp.InvalidCertificate += new FtpInvalidCertificate(OnInvalidCertficate);
                ftp.Download(file, local);
            }

 

It is basically the code from the download example. The Url I am trying to connect to is:

mbl02dintsrv08.*.com/imaging

10.26.224.*/imaging

ftp://10.26.224.*/imaging

ftp://mbl02dintsrv08.*.com/imaging

 

I get the exact error using the different variations of the url. I have verified that I can connect and download a file using another FtpClient library to the same Url. Any suggestions?

 

Thanks

Aug 20, 2012 at 6:35 PM

And just for clarification, the above Url's are the same. one is the DNS and the other the IP.

Coordinator
Aug 20, 2012 at 8:31 PM

Use the host name, not a URL. There is a URI constructor that was submitted as a patch but I don't recall it taking username and passwords as parameters which would generally be part of the URI.

Aug 21, 2012 at 7:26 PM

So an IP cant be used?

Coordinator
Aug 21, 2012 at 7:50 PM

Sure it can. An IP address is not a URL. A host name is not a URL. When System.Net.FtpClient asks for a host name or the server it expects a host name or an IP address, not a URL.