protected string GetIP()
{
string localIP = null;
IPHostEntry localEntry = Dns.GetHostEntry(Dns.GetHostName());
foreach (IPAddress Ip in localEntry.AddressList)
{
if (Ip.AddressFamily.ToString() == "InterNetwork")
localIP = Ip.ToString();
}
return localIP;
}
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = GetIP();
}
{
string localIP = null;
IPHostEntry localEntry = Dns.GetHostEntry(Dns.GetHostName());
foreach (IPAddress Ip in localEntry.AddressList)
{
if (Ip.AddressFamily.ToString() == "InterNetwork")
localIP = Ip.ToString();
}
return localIP;
}
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = GetIP();
}
No comments:
Post a Comment