title: ASP.NET Web API: How do you read server variables in a Web API controller?
body: <p>How would you read the following server variables in an ASP.NET <strong>Web API</strong> controller?</p>
  
  <pre><code>HTTP_HOST
  SERVER_NAME
  REMOTE_HOST / REMOTE_ADDR
  </code></pre>
  
  <p>I see a System.Net.Http.HttpRequestMessage Request defined, but I don't see a collection containing these variables.</p>
  
  <p>I'm running a website on a single IP with multiple host headers and I need to determine which site they used to get there.</p>
  
  <p>EDIT:</p>
  
  <p>It ended up being something like this:</p>
  
  <pre><code>((System.Web.HttpContextWrapper) Request.Properties["MS_HttpContext"])
      .Request.ServerVariables["HTTP_HOST"]
  </code></pre>