Today at work I had to find the IP address of the client machine (don't ask) so I thought I'd post the code here so I'd know where to look for it the next time :)

private void button1_Click(object sender, EventArgs e)
{
   string hostName = Dns.GetHostName();
   IPHostEntry hostEntry = 
      Dns.GetHostEntry(hostName);
   foreach (IPAddress a in hostEntry.AddressList)
   {
      this.textBox1.Text += a.ToString() + 
         Environment.NewLine;
   }
}
Technorati tags: , ,