I want to get the client IP address in m global.cs file. I'm using Request.UserHostAddress but it's returning only "::1" not the whole IP address and also tried System.Web.HttpContext.Current.Request.UserHostAddress
but no use.
Asked
Active
Viewed 66 times
0

halfer
- 19,824
- 17
- 99
- 186

Rohan Sampat
- 930
- 1
- 13
- 30
-
1This is because you are running with localhost, once you upload your web on live you will get the output as expected. http://stackoverflow.com/q/10517371/1433093 – Kundan Singh Chouhan Dec 18 '16 at 13:30
-
1This is not a bug, “::1” is a perfectly legal IPv6 address and is the IPv6 equiv. of 127.0.0.1.As said by Kundan you will get perfect result once you host the application. check this http://stackoverflow.com/questions/6408957/request-userhostaddress-issue-with-return-result-1 – Anadi Dec 18 '16 at 15:42