Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to get user IP address in an application using javascript..can any one help?
Posted
Updated 24-Jan-13 22:40pm
v2

 
Share this answer
 
v3
Comments
Maruthiram_99 25-Jan-13 5:13am    
I just want to display current system IP address i.e my system IP address,country name,city,zipcode etc as labels in my screen
Abhishek Pant 25-Jan-13 5:25am    
check the updated answer
I don't think it is possible to get client IP address purely in JavaScript.

If you are fine wtih some code in server side, you can try having a hidden field in the ASPX page, and assign Request.UserHostAddress to that hidden field. Now, in javascript you can use getelementbyid of the hidden variable.

[Update after OP's comment]
In original question you said User's IP. Anyway, if it ASP.Net application, you can't find user's IP Address only through JavaScript. For Server (where you code is hosted i.e. your machine) IP address, you can check http://stackoverflow.com/questions/1345676/how-to-get-the-server-ip-address[^]


Hoep that helps.
Milind
 
Share this answer
 
v3
Comments
Maruthiram_99 25-Jan-13 5:13am    
I just want to display current system IP address i.e my system IP address,country name,city,zipcode etc as labels in my screen
MT_ 25-Jan-13 5:15am    
In original question you said User's IP. Anyway, if it ASP.Net application, you can't find user's IP Address only using Javascript. For Server (where you code is hosted i.e. your machine), you can check http://stackoverflow.com/questions/1345676/how-to-get-the-server-ip-address - Milind

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