title: How to get full host name + port number in Application_Start of Global.aspx?
body: <p>I tried </p>
  
  <pre><code>Uri uri = HttpContext.Current.Request.Url;
  String host = uri.Scheme + Uri.SchemeDelimiter + uri.Host + ":" + uri.Port;
  </code></pre>
  
  <p>and it worked well on my local machine, but when being published to IIS7, there is an exception saying</p>
  
  <pre><code>System.Web.HttpException: Request is not available in this context
  </code></pre>
  
  <p>Anyone know how to achieve this?</p>