How to get Domain name

Total Post:36

 1278  View(s)
Rate this:
i want to get domain name in
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. Post:194

    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


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.