Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET Javascript
I want to get user IP address in an application using javascript..can any one help?
Posted 24-Jan-13 23:39pm
Edited 24-Jan-13 23:40pm
MT_10.3K
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
v3
Comments
Maruthiram_99 at 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 at 25-Jan-13 5:25am
   
check the updated answer
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
v3
Comments
Maruthiram_99 at 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
Milind_T at 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)

  Print Answers RSS
0 Maciej Los 424
1 ridoy 410
2 DamithSL 240
3 OriginalGriff 179
4 Suvendu Shekhar Giri 150
0 OriginalGriff 8,033
1 DamithSL 6,179
2 Sergey Alexandrovich Kryukov 5,538
3 Maciej Los 5,508
4 Kornfeld Eliyahu Peter 4,539


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 25 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100