且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从网站网址列表中提取域名

更新时间:2023-09-21 23:36:10

查看以下内容是否有用。

See if the following is helpful.

https://***.com/questions/14211973/get-host-domain-from-url

从上面的链接

string host = Request.Url.Host;

Uri myUri = new Uri("http://www.contoso.com:8080/");   
string host = myUri.Host;  // host is "www.contoso.com"


Uri.GetLeftPart( UriPartial.Authority )