Click here to Skip to main content
16,021,285 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do i find user's public IPAddress


Any help would be greatly appreciated.

Thank u
Posted

Depends on your environment.
For a website,
C#
Request.ServerVariables["REMOTE_ADDR"]
should do it, but it's better to use
C#
Request.ServerVariables["HTTP_X_FORWARDED_FOR"] ?? Request.ServerVariables["REMOTE_ADDR"]
 
Share this answer
 
Comments
Member 9664530 20-Jun-14 4:02am    
Thanks for your help !
I have tried with this, iam getting the IPV6 address of my webSite . But I need the IP address of the user's machine i.e the user's IPAddress who is accessing my website
Try this
C#
string ip = Request.UserHostName;


Refer StackOverflow
 
Share this answer
 

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