Click here to Skip to main content
16,015,583 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have published my web site on server. want to get the IP Address of the machines from where my website is browsed and save them in table.How can i get the IP Addresses ?I have Googled for it.Tried some things but they return the IP address of server machine not the user/client machine
Help Me..
Posted
Updated 5-Aug-14 2:38am
v2

1 solution

Try:
C#
Request.ServerVariables("REMOTE_ADDR")

or
C#
Request.UserHostAddress

or
C#
Request.ServerVariables("HTTP_X_FORWARDED_FOR")


--Amy
 
Share this answer
 
Comments
pwavell 5-Aug-14 8:49am    
running on local machine(asp.net development server) Request.ServerVariables["REMOTE_ADDR"] returns ::1 but not the IP. and
Request.ServerVariables["HTTP_X_FORWARDED_FOR"] returns null.
_Amy 5-Aug-14 8:52am    
Thats IPv6's version of 127.0.0.1. If you have IPv6 installed on your local machine this shows. Once the application is deployed it should work fine and display the IPv4 address instead of IPv6.
pwavell 5-Aug-14 9:25am    
Published it on my local iis,still returns ::1.
_Amy 5-Aug-14 9:36am    
Because, in your system IPv6 is installed. See, Installing TCP/IP networking[^] and install IPv4.

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