Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Get client PC IP address when my web application load
in my code it display me my server IP Address when i am going to host this code on server
I want to know the Client IP Address

string ipaddress;
           ipaddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
           if (ipaddress == "" || ipaddress == null)
               ipaddress = Request.ServerVariables["REMOTE_ADDR"];
           Response.Write("IP Address : " + ipaddress);
Posted

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900