private static string GetProtocolFromUrl(string url)
{
const string protocolIndicator = "://";
int idxProtocol = url.IndexOf(protocolIndicator);
if(idxProtocol < 1)
{
throw new Exception("No protocol found in " + url);
}
string protocol = url.Substring(0, idxProtocol + protocolIndicator.Length);
return protocol.ToLower();
}