I am trying to extract just the domain name from a URL string. I almost have it... I am using URI
I have a string.. my first thought was to use Regex but then i decided to use URI class
I need to convert the above to google.com and google without the www
I did the following
Uri test = new Uri(referrer);
log.Info("Domain part : " + test.Host);
Basically this returns www.google.com .... i would like to try and return 2 forms if possible... as mentioned...
google.com and google
Is this possible with URI?
Yes, it is possible use:
Uri.GetLeftPart( UriPartial.Authority )