so i have a code which gets me the ip address of a machine i am wroking on.
so if my gui is published on the server and i access it from my local machine it gives me tha address of my local machine and when i access the gui from the server itself it gives me the server address.. which is fine.
But when i put the gui on a VM server and run it from a VM server itself i dont get the ip address. this works fine if i access it from another machine but does not work only when accesing gui on VM server..
please help me out as i get this value ":::1"
here is my code:
string ipaddress;
//string ipaddress = Request.ServerVariables["LOCAL_ADDR"];
string ipaddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (ipaddress == "" || ipaddress == null)
string ipaddress = Request.ServerVariables["REMOTE_ADDR"];
Label5.Text = ipaddress;
thank you