title: ASP.NET - Get website's URL without HttpContext.Current (running in background thread)
body: <p>Bit of a long shot, but is there a way in ASP.NET to dynamically get the website's URL (<a href="http://www.example.com" rel="nofollow noreferrer">http://www.example.com</a>) when there is no HttpContext.Current available.</p>
  
  <p>There is no HttpContext because the code is running in a background thread* (but under the ASP.NET AppDomain). I have a background process that sends emails out every evening, and needs to include the Web address, but I don't want to hard code it because of deployments and testing (it changes from <a href="http://localhost:12345" rel="nofollow noreferrer">http://localhost:12345</a> to <a href="http://testing.example.com" rel="nofollow noreferrer">http://testing.example.com</a> and then to <a href="http://www.example.com" rel="nofollow noreferrer">http://www.example.com</a> for the live site).</p>
  
  <p>*Please don't advise a Windows Service, I'm aware of these but hosting restrictions prevent me from doing this.</p>