Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Sir/Ma'am


i create a website .
i want to fetch the ipaddress of the clients.
i run it at server and at two client but ip shown at a label.
but on all the systems only server ip is shown.
i want to see the ip of system at which website is running .Please help me
Posted
Updated 17-Mar-13 22:17pm
v3
Comments
OriginalGriff 18-Mar-13 4:15am    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.
ankur789 18-Mar-13 4:16am    
sory sir but i am not shouting sir

Easy: Request.UserHostAddress returns it: MSDN[^]
 
Share this answer
 
Hi!!!
you don;t post your code !!! can you post the are you using and below code can capture the Ip Address like this:



CSS
HttpRequest currentRequest = HttpContext.Current.Request;
      string ipAddress = currentRequest.ServerVariables["HTTP_X_FORWARDED_FOR"];

     if (ipAddress == null || ipAddress.ToLower() == "unknown")
          ipAddress = currentRequest.ServerVariables["REMOTE_ADDR"];

     return ipAddress;


or like this

C#
String ipAddress =
        System.Web.HttpContext.Current.Request.UserHostAddress;


take a look of this link
http://www.c-sharpcorner.com/uploadfile/krishnasarala/find-client-ip-address-and-location-in-Asp-Net/[^]
 
Share this answer
 
v2
C#
string ipAddress = Request.ServerVariables["REMOTE_HOST"].ToString();
 
Share this answer
 
v2

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