title: Get all server variables in ASP.NET Core
body: <p>I want to fetch a list of all server variables in ASP.NET Core. Back in the ASP.NET days, you could simply use the list available on <code>Request.ServerVariables</code>. To my knowledge, ASP.NET Core doesn't have a similar construct. You can do this:</p>
  <pre class="lang-cs prettyprint-override"><code>var serverVariables = httpContext.Features.Get&lt;IServerVariablesFeature&gt;();
  var value = serverVariables[&quot;AUTH_USER&quot;];
  </code></pre>
  <p>to get a single user variable. I also know about the extension method fetching a single variable from the HTTP context. But there doesn't seem to be a way to fetch all variables without being explicit about the names like this:</p>
  <pre class="lang-cs prettyprint-override"><code>private const string ServerVariableNames = &quot;APPL_PHYSICAL_PATH,AUTH_USER,AUTH_TYPE,...&quot;;
  var serverVariables = ServerVariableNames.Split(new[] { ',' }).Select(name =&gt; new {name, value = serverVariablesFeature[name])));
  </code></pre>
  <p>With this solution, I need to list all server variables manually.</p>
  <p>There's the <code>ALL_HTTP</code> variable but that one only includes request headers and not server variables like <code>SERVER_NAME</code> and <code>SERVER_SOFTWARE</code>.</p>
  <p>Any ideas on how to do this?</p>