title: How to get ASP.NET MVC application's base url in Startup.cs file?
body: <p>I am looking for a way to get the root url of my web application so I wouldn't have to use a hardcoded string where I need it. </p>
  
  <p>So far I've tried to get it this way:</p>
  
  <pre><code>var request = HttpContext.Current.Request;
  
  var url = string.Format("{0}://{1}",
            request.Url.Scheme,
            request.Url.Authority);
  </code></pre>
  
  <p>but unfortunately this doesn't give me the desired result when executed from the Startup class, I got <code>http://127.0.0.1</code></p>