protected void Page_Load(object sender, EventArgs e)
{
string _IP = null;
string strHostName = System.Net.Dns.GetHostName();
IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(strHostName);
foreach (IPAddress ipAddress in ipEntry.AddressList)
{
if (ipAddress.AddressFamily == AddressFamily.InterNetwork)
{
_IP = ipAddress.ToString();
}
}
Response.Write(_IP);
}
{
string _IP = null;
string strHostName = System.Net.Dns.GetHostName();
IPHostEntry ipEntry = System.Net.Dns.GetHostEntry(strHostName);
foreach (IPAddress ipAddress in ipEntry.AddressList)
{
if (ipAddress.AddressFamily == AddressFamily.InterNetwork)
{
_IP = ipAddress.ToString();
}
}
Response.Write(_IP);
}
0 comments:
Post a Comment