hi all,

In my page i need to get the system ip address. i used this code.

string myHost = System.Net.Dns.GetHostName();
string myIP = System.Net.Dns.GetHostByName(myHost).AddressList[0].ToString();

this is working fine when i run application in local system. Now i hosted that application in server say(10.20.7.63). so now when i access that application from my system i am getting ipaddress as 10.20.7.63 which is servers IP. But i need my system ip address.. so can anyone help me please..

Thank u.

Let me explain you clearly..
i developed a website. In that when i open it will automatically take IP address of my system in a textbox. Now i hosted that in a server through IIS. When we access that application in different systems we are getting same IP address i;e IP address of the server where i hosted. But i need to get the IP address of the system in which i opened the application.

than you need to write that to client side.. i mean using java script or something like that..

and pass it to server..

it's just a theory..

try this

string myHost = System.Net.Dns.GetHostName();
Label1.Text = myHost;

string myIP = System.Net.Dns.GetHostByName(myHost).AddressList[0].ToString();
Label2.Text = myIP;

After hours of search in google my problem got solved here is what i had done

string myIP = this.Page.Request.ServerVariables["REMOTE_ADDR"];

if you run this in local we get "127.0.0.1" but when it is hosted it gives the clients IP address.

This question has already been answered. Start a new discussion instead.