Solved

Why GetHostEntry behaviour is different

Posted on 2008-10-14
3
1,005 Views
Last Modified: 2010-04-21
Hello,

Could anyone please  take up this task. It is very important for us. Now I am having only one question. Why

Console.WriteLine("The FQDN host name is : " + Dns.GetHostEntry(string.Empty).HostName); prints just host name. Actually it prints "hostname.site.domain.com" in FQDN format but we have some hosts where it gives only "hostname" and that causing the problem.

Is it related to TCP IP parameters in registry??

Thanks.
0
Comment
Question by:deshaw
  • 2
3 Comments
 
LVL 1

Author Comment

by:deshaw
ID: 22710908
Hello,

We have solved this issue by removing  server name from hosts file. We show that in hosts file we have given hostname like "hostname IP" and not given topdomain name. This was a citrix server. Could  any one not tell what is the relationship between hosts file and GetHostEntry function?

Thanks.
0
 
LVL 38

Accepted Solution

by:
PaulHews earned 500 total points
ID: 22717687
>Could  any one not tell what is the relationship between hosts file and GetHostEntry function?

The hosts file acts as an override to DNS resolution.  If it is defined that way in the hosts file, it will supersede what is defined by your DNS service.

http://en.wikipedia.org/wiki/Hosts_file
http://accs-net.com/hosts/what_is_hosts.html

When you call  Dns.GetHostEntry(string.Empty).HostName you are querying DNS to resolve the name of the localhost.  If it's defined there in the hosts file, that's what will be returned.
0
 
LVL 1

Author Closing Comment

by:deshaw
ID: 31505813
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now