Dns.GetHostEntry(hostName) - No such host is known
<p>As the title suggests I get the socket exception : 'No such host is known', when calling the Dns.GetHostEntry method. </p>

<p>Dns.GetHostName is used to find the hostname for the machine.</p>

<p>I understand the host name that gets resolved using Dns.GetHostName could be the reason behind the socket exception. I am trying to understand what could possibly cause varying results resolving host name using the GetHostName method. Could it be the environment?</p>

<p>The socket exception is random and is in intranet environment and not every user gets this. I do not believe a FQDN could be a reason as i have tested in my machine where the resolved hostname was a short name.</p>

<p>The code is as below:</p>

<pre><code> var hostName = Dns.GetHostName();
 var entry = Dns.GetHostEntry(hostName);
</code></pre>

<p>Additionally what are the possible alternatives to Dns.GetHostName?</p>