如何从URI中排除子域

时间:2013-01-24 05:01:45

标签: c# asp.net uri

  

可能重复:
  Getting domain from subdomain

我有一个查询,其中我从URI获取主机名。

Eg. if i have http://www.google.com/abc/abcd/ade/a.htm

then the url is "www.google.com" 

var uri = new Uri("http://www.google.com/abc/abcd/ade/a.htm");
uri.Host // i get www.google.com

But when i try it with Subdomain i want to exclude the Subdomain from the url

var uri = new Uri("http://mail.google.com/abc/abcd/ade/a.htm");
    uri.Host // i get mail.google.com

I want only google.com

0 个答案:

没有答案