title: How to get HttpContext.Current in ASP.NET Core?
body: <p>We are currently rewriting/converting our ASP.NET WebForms application using ASP.NET Core. Trying to avoid re-engineering as much as possible.</p>
  
  <p>There is a section where we use <code>HttpContext</code> in a class library to check the current state. How can I access <code>HttpContext.Current</code> in .NET Core 1.0?</p>
  
  <pre><code> var current = HttpContext.Current;
       if (current == null)
        {
         // do something here
         // string connection = Configuration.GetConnectionString("MyDb");
        }
  </code></pre>
  
  <p>I need to access this in order to construct current application host.</p>
  
  <pre><code>$"{current.Request.Url.Scheme}://{current.Request.Url.Host}{(current.Request.Url.Port == 80 ? "" : ":" + current.Request.Url.Port)}";
  </code></pre>