You can use UriBuilder or Uri and grab the host portion.