Solved

Why GetHostEntry behaviour is different

Posted on 2008-10-14
3
999 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 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

19 Experts available now in Live!

Get 1:1 Help Now