To retrieve the IP Address of the Machine on which the code is executed, you can use the following code:
string hostName = System.Net.Dns.GetHostName(); //get the name of the computerā¦
//gets the Ipaddress of the machineā¦
string IPAdd = System.Net.Dns.GetHostEntry(hostName ).AddressList[0].ToString();