title: Get client computer name in MVC 4
body: <p>The method below is used to get the client machine name in MVC 4. I've noticed that for some clients it returns an empty string, any idea why this could happen?</p>
  
  <p>Is there another,more reliable way to get the clients machine name?</p>
  
  <pre><code>private string GetWorkstation()
      {
          string ip = Request.UserHostName;
          IPAddress myIP = IPAddress.Parse(ip);
          IPHostEntry GetIPHost = Dns.GetHostEntry(myIP);
          List&lt;string&gt; compName = GetIPHost.HostName.ToString().Split('.').ToList();
          return compName.First().ToUpper();
      }
  </code></pre>