Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Why GetHostEntry behaviour is different

Posted on 2008-10-14
3
Medium Priority
?
1,032 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

636 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