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( so now when i access that application from my system i am getting ipaddress as which is servers IP. But i need my system ip address.. so can anyone help me please..

Thank u.

Try this. I don't understand the problem fully but this is what I use to get the computer's 'external' IP that you can connect to it from, especially if it is behind a router.

string IP = new WebClient().DownloadString("http://automation.whatismyip.com/n09230945.asp");

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;

i tried that but i am not getting clients IP address

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 "" but when it is hosted it gives the clients IP address.