title: How to get current domain name in ASP.NET
body: <p>I want to get the current domain name in asp.net c#.</p>
  
  <p>I am using this code.</p>
  
  <pre><code>string DomainName = HttpContext.Current.Request.Url.Host;
  </code></pre>
  
  <p>My URL is <code>localhost:5858</code>but it's returning only <code>localhost</code>. </p>
  
  <p>Now, I am using my project in localhost. I want to get localhost:5858.</p>
  
  <p>For another example, when I am using this domain </p>
  
  <pre><code>www.somedomainname.com
  </code></pre>
  
  <p>I want to get <code>somedomainname.com</code></p>
  
  <p>Please give me an idea how to get the current domain name.</p>