title: Host vs DnsSafeHost
body: <p>I need to get the host out of the Request object. Which property should I use and why?</p>
  
  <p>From MSDN:</p>
  
  <blockquote>
    <p><strong>Uri.DnsSafeHost Property</strong></p>
    
    <p>A String that contains the unescaped
    host part of the URI that is suitable
    for DNS resolution; or the original
    unescaped host string, if it is
    already suitable for resolution.</p>
  </blockquote>
  
  <p>vs</p>
  
  <blockquote>
    <p><strong>Uri.Host Property</strong></p>
    
    <p>A String that contains the host name.
    This is usually the DNS host name or
    IP address of the server.</p>
  </blockquote>
  
  <p>My testing has been with the ASP.NET Development Server. Both of these always return <code>localhost</code>. Even when I put in 127.0.0.1, both return <code>localhost</code>.</p>
  
  <p>Reading on, the <code>DnsSafeHost</code> property will handle IPv6 addresses, as well as Unicode to ASCII conversion if needed. It can also account for IRI and IDN. Even though I currently don't care about these things, should I just use the <code>DnsSafeHost</code> property to be safe?</p>