This project is read-only.

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

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


 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:






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?



Aug 20, 2012 at 7:35 PM

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

Aug 20, 2012 at 9: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 8:26 PM

So an IP cant be used?

Aug 21, 2012 at 8: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.