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();