Possible Duplicate:
How to get local ip address using vb?
I am using Silverlight3 with VB.NET. I have written the follwing code in my service file. When I run my project locally, it gives the IP address of my system as 192.168.1.12 successfully. But, when I host my project it wont return the IP adress of the system which I am using.
ie: If i host my project in system A which is of ip 192.168.1.12 and if I access the project from system B which is of ip 192.168.1.7, the output of my project will gives the IP of system A (where i have hosted my project). It should give the IP of system B where am running it. Similarly, if am accessing the project from system C means it should give the IP of system C, but here it is returning the IP of system A.
Kindly help me please. Thanks
Private Function fnLocalIp() As String
Try
Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName)
Dim strLocalIp As String = h.AddressList.GetValue(0).ToString
Return strLocalIp
Catch ex As Exception
End Try
End Function