Solved

Why GetHostEntry behaviour is different

Posted on 2008-10-14
3
1,011 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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

831 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