Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
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 17-Mar-13 23:10pm
ankur7891.4K
Edited 17-Mar-13 23:17pm
v3
Comments
OriginalGriff at 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.
AnkurGupta OM at 18-Mar-13 4:16am
   
sory sir but i am not shouting sir
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Easy: Request.UserHostAddress returns it: MSDN[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi!!!
you don;t post your code !!! can you post the are you using and below code can capture the Ip Address like this:
 

 
       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
 
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/[^]
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

string ipAddress = Request.ServerVariables["REMOTE_HOST"].ToString();
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 5,170
1 DamithSL 4,357
2 Maciej Los 3,750
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,851


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 18 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100