Obtenha subdomínio específico do URL em foo.bar.car.com

Dado um URL da seguinte forma:

foo.bar.car.com.au

Eu preciso extrairfoo.bar.

Eu me deparei com o seguinte código:

private static string GetSubDomain(Uri url)
{
    if (url.HostNameType == UriHostNameType.Dns)
    {
        string host = url.Host;
        if (host.Split('.').Length > 2)
        {
            int lastIndex = host.LastIndexOf(".");
            int index = host.LastIndexOf(".", lastIndex - 1);
            return host.Substring(0, index);
        }
    }         
    return null;     
}

Isso me dá gostofoo.bar.car. Eu quero foo.bar. Devo usar apenas dividir e tirar 0 e 1?

Mas então há possível wwww.

Existe um caminho fácil para isso?

questionAnswers(4)

yourAnswerToTheQuestion