By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,994 Members | 2,036 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,994 IT Pros & Developers. It's quick & easy.

getting ip address of client in asp.net

P: 9
Hi !
I have used "System.Web.HttpContext.Current.Request.UserHostAd dress " and " Request.ServerVariables["REMOTE_ADDR"] ".
But at both times i got only " 127.0.0.1 " WHY ? and what is the code to get te ip address of the clients visiting my website ?
Apr 20 '07 #1
Share this Question
Share on Google+
3 Replies


RedSon
Expert 5K+
P: 5,000
Hi !
I have used "System.Web.HttpContext.Current.Request.UserHostAd dress " and " Request.ServerVariables["REMOTE_ADDR"] ".
But at both times i got only " 127.0.0.1 " WHY ? and what is the code to get te ip address of the clients visiting my website ?
Are you testing your code from a server running on your local machine? Are you also testing your code from a client running on your local machine? If you are connecting to your sever locally then all you will see is 127.0.0.1. You need to test it from another client that is on a different machine.
Apr 20 '07 #2

radcaesar
Expert 100+
P: 759
Request.UserHostAddress() will get the client ip
Apr 20 '07 #3

P: 9
Are you testing your code from a server running on your local machine? Are you also testing your code from a client running on your local machine? If you are connecting to your sever locally then all you will see is 127.0.0.1. You need to test it from another client that is on a different machine.
Ya that right... Now i uploaded the code on server and i got it correctly. Thanks for ur help
Apr 21 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.