Argentini.Halide.H3Http.GetHostRoot C# (CSharp) Method

GetHostRoot() public static method

Get the root domain from the fully qualified domain name of the current URL. (e.g. if visiting "www.mydomain.com", "mydomain.com" is returned.)
public static GetHostRoot ( ) : String
return String
        public static String GetHostRoot()
        {
            String fqdn = GetHost();
            String dn = fqdn;
            String[] dnParts = fqdn.Split('.');

            if (dnParts.Length > 1)
            {
                dn = dnParts[dnParts.Length - 2] + "." + dnParts[dnParts.Length - 1];
            }

            return dn;
        }