Here is an idea that I came up with.
@SLaks, I would like your thoughts on this here.
''
<Extension()>
Public Function PrimaryDomain(ByVal url As Uri) As String
If url.Host.Contains("example.com") Then Return "example.com"
If url.Host.Contains("example.ca") Then Return "example.ca"
If url.Host.Contains("example.local") Then Return "example.local"
If url.Host.Contains("localhost") Then Return "localhost"
Throw New Exception("The url host was not recognized as a known host name for this domain.")
End Function
source
share