Connecting to FTP site via VB.NET

Using IIS I created an FTP site called FTPTest.  The site allows anonymous connections.  If I type 'ftp://localhost/ftptest' into IE, I can see the documents and there are no problems.  However, if I attempt to do the same in code I get the following message:

System.Net.Sockets.SocketException: The requested name is valid and was found in the database, but does not have the correct associated data being resolved for
at System.Net.Dns.GetHostName
at  System.Net.Dns.Resolve, etc....

I have added the following line to my Hosts file:

xx.xx.xxx.xx    FTPTest  (with the correct IP address of course)

I get this message on this line of code


Try
         BuildConnection(Dns.Resolve(ServerAddr).AddressList(0), FtpPort) <----------------  Here
Catch err As Exception
            MsgBox(err.ToString())
            Me.Dispose()
End Try


Any help would be appreciated
LVL 6
JRossi1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

nayernaguibCommented:
If the value of the ServerAddr string is anything other than "FTPTest", try setting it to this value.

_______________

  Nayer Naguib
0
nayernaguibCommented:
Setting ServerAddr to "ftp://somehostname" or "http://somehostname" will also throw an exception.

Otherwise, if you would like to set ServerAddr to "localhost/FTPTest", then you should modify the hostname in the hosts file to become "localhost/FTPTest".

Note that when testing your code using other FTP hostname values, you should not use the "ftp://" prefix. This prefix specifies the *protocol*, which has nothing to do with the hostname. However, if the hostname includes the prefix "ftp." (as in "ftp.simtel.net"), you *must* include it, as it is a part of the hostname.

_______________

  Nayer Naguib
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JRossi1Author Commented:
Sorry for not answering sooner.  I have been out sick.  Anyway, your advice regarding the Hosts file worked.  However, the FTP site is rejecting my password.  I have the 'Allow Anonymous Access' checked and I typed in my email address as the password, but it is not accepted.  Is there some default password that is used when the 'Allow Anonymous Access' is checked?

Thanks...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.