【发布时间】:2017-03-20 20:14:14
【问题描述】:
我想获取不带“http”和“www”的域名。
例如:
https://www.google.com => google.com
http://www.google.com => google.com
www.google.com => google.com
尝试:
Dim myUri As New Uri(url)
Dim host = myUri.Host
Dim host1 = myUri.AbsolutePath
Dim host2 = myUri.AbsoluteUri
Dim host3 = myUri.Authority
Dim host4 = myUri.DnsSafeHost
Dim host5 = myUri.Fragment
Dim host6 = myUri.HostNameType
这些都不适合我。有人可以指导我如何在 C# 或 VB.Net 中实现上述目标(最好是 VB.Net)
【问题讨论】:
-
您要排除各种子域(例如 codereview.stackexchange.com => stackexchange.com)还是只排除 www?
-
我只想摆脱 www