To get the ip address of the local machine we can use IPHostEntry and Dns in C#
Here is the sample code to get the ip address of the local machine
protected void Page_Load(object sender, EventArgs e)
{
string hostName = Dns.GetHostName();
IPHostEntry local = Dns.GetHostEntry(hostName);
foreach (IPAddress ipaddress in local.AddressList)
{
Response.Write("IPAddress = " + ipaddress.ToString());
}
}