if (location.hostname=="www.3456.net") { location.replace("3456/")} The information inquiry of domain name .............................. void doQuery(Object sender, EventArgs e) { String strDomain; String strServer; //strServer = "whois.paycenter.com.cn"; //新網(wǎng)的Whois,聯(lián)接查詢速度較快,但不是在新網(wǎng)注冊的域名可能無法顯示詳細資料 strServer = "66.150.5.140"; //whois.uwhois.com if(txtDomain2.Checked) { strDomain = txtDomain1.Text+txtDomain2.Text; } else { if(txtDomain3.Checked) { strDomain = txtDomain1.Text+txtDomain3.Text; } else { if(txtDomain4.Checked) { strDomain = txtDomain1.Text+txtDomain4.Text; } else { if(txtDomain5.Checked) { strDomain = txtDomain1.Text+txtDomain5.Text; } else { strDomain = txtDomain1.Text+txtDomain6.Text; } } } } String strResponse; bool bSuccess = DoWhoisLookup(strDomain, strServer, out strResponse); if (bSuccess) { txtResult.Text = strResponse; } else { txtResult.Text = "查詢失。≌堉卦。"; } } bool DoWhoisLookup(String strDomain, String strServer, out String strResponse) { strResponse = "none"; bool bSuccess = false; TcpClient tcpc = new TcpClient(); tcpc.Connect(strServer, 43); strDomain += "\r\n"; Byte[] arrDomain = Encoding.UTF8.GetBytes(strDomain.ToCharArray()); try { Stream s = tcpc.GetStream(); s.Write(arrDomain, 0, strDomain.Length); StreamReader sr = new StreamReader(tcpc.GetStream(), Encoding.UTF8); StringBuilder strBuilder = new StringBuilder(); while (-1 != sr.Peek()) { strBuilder.Append(sr.ReadLine()+""); } tcpc.Close(); bSuccess = true; strResponse = strBuilder.ToString(); } catch(Exception e) { strResponse = e.ToString(); } return bSuccess; } Domain Name : www.