System.Net.WebProxyScriptHelper.WebProxyScriptHelper.dnsResolve C# (CSharp) Method

dnsResolve() public method

public dnsResolve ( string host ) : string
host string
return string
        public string dnsResolve(string host) {
            GlobalLog.Print("WebProxyScriptHelper::dnsResolve() host:" + ValidationHelper.ToString(host));
            if (host==null) {
                if(Logging.On)Logging.PrintWarning(Logging.Web, SR.GetString(SR.net_log_proxy_called_with_null_parameter, "WebProxyScriptHelper.dnsResolve()", "host"));
                throw new ArgumentNullException("host");
            }
            IPHostEntry ipHostEntry = null;
            try
            {
                ipHostEntry = Dns.InternalGetHostByName(host);
            }
            catch { }
            if (ipHostEntry == null)
            {
                return string.Empty;
            }
            for (int i = 0; i < ipHostEntry.AddressList.Length; i++)
            {
                if (ipHostEntry.AddressList[i].AddressFamily == AddressFamily.InterNetwork)
                {
                    return ipHostEntry.AddressList[i].ToString();
                }
            }
            return string.Empty;
        }