---
title: "How to get  Domain name"  
description: "How to get  Domain name"  
author: "Anonymous User"  
published: 2014-10-04  
updated: 2014-10-04  
canonical: https://www.mindstick.com/forum/2294/how-to-get-domain-name  
category: "asp.net"  
tags: ["c#", ".net", "asp.net", "asp.net mvc"]  
reading_time: 1 minute  

---

# How to get  Domain name

i want to get [domain name](https://www.mindstick.com/articles/12298/how-to-select-seo-friendly-domain-names-for-your-new-website) in [asp.net](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder)i'm using this [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii)

[string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) DomainName = [HttpContext](https://www.mindstick.com/forum/2164/how-to-get-dot-net-httpcontext-for-isolated-code-block).Current.Request.[Url](https://www.mindstick.com/forum/436/url-redirection).Host;

my url is http://localhost:55589/ but it is return only localhost

[now](https://yourviews.mindstick.com/view/81402/it-s-liberals-vs-progressives-in-us-politics-now) i'm want to get http://localhost:55589/ how to possible

\

## Replies

### Reply by Anonymous User

Try getting the “left part” of the url, like this:

string DomainName = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority);

this will return you http://localhost:55589


---

Original Source: https://www.mindstick.com/forum/2294/how-to-get-domain-name

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
