HOW TO GET DOMAIN NAME

Pawan Shukla

Total Post:38

Points:274
Posted by  Pawan Shukla
 892  View(s)
Ratings:
Rate this:
i want to get domain name in asp.net
i'm using this code

string DomainName = HttpContext.Current.Request.Url.Host;

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

now i'm want to get http://localhost:55589/ how to possible


  1. Kamlakar Singh

    Post:194

    Points:1396
    Re: How to get Domain name

    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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!