HOW TO GET DOMAIN NAME

Pawan Shukla

Total Post:36

Points:260
Posted by  Pawan Shukla
 1053  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

      Modified On Apr-05-2018 06:27:59 AM

Answer

NEWSLETTER

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