C#獲取本地電腦的IP地址

//獲取本地的IP地址
string AddressIP = string.Empty;
foreach (IPAddress _IPAddress in Dns.GetHostEntry(Dns.GetHostName()).AddressList)
{
    if (_IPAddress.AddressFamily.ToString() == "InterNetwork")
    {
        AddressIP = _IPAddress.ToString();
    }
}
Response.Write(AddressIP);
© 2008- 騰雲網 版權所有
返回首頁