Duncan Mackenzie posted about people asking how to obtain the IP address of your internet connection. He created a web service for this task including the VB code to access it.
Here is my C# version of the code,
1. First you need to add a web reference to the web service IPInfo.asmx
2. And now the code (all prettied up for your easy perusal)...
//Show Waitcursor while web service is being called
Cursor.Current = Cursors.WaitCursor;
//Create instance of web service and obtain IP address
net.duncanmackenzie.www.IPInfo IP = new net.duncanmackenzie.www.IPInfo();
myIPAddress = IP.GetMyIP();
//Show normal cursor
Cursor.Current = Cursors.Default;
//Display IP adddress
System.Windows.Forms.MessageBox.Show("Your IP address is " + myIPAddress);
This can be done just as easily in a console app if desired.
Thanks to Duncan for the code and web service.
Currently listening to: Crush (1980 Me) - (04:00)
Darren Hayes, Spin