How to get client IP address assigned by ISP


Status
Not open for further replies.
M

Mike

Hi ASP Gurus,
Please help me solving my problem.
I am trying to get the clients IP address but I am not able to do it
successfully. I have tried:
Request.ServerVariables("http_user_agent")
Request.ServerVariable("remote_addr")

But I am getting something like '125.1.1*'

What do I need to get the IP address assigned my the ISP.

I'll appreciate any help you can provide.

Thanks, Mark
 
Ad

Advertisements

M

Mike

Thanks Mark for your quick response.
But when I go the website http://whatismyipaddress.com/ it does return my
correct IP address. There are other websites also which shows correct IP
address.
We are tring to capture this information and store it for some
troubleshooting later on.

How does other website caputures it?

Thanks, Mark
 
S

Steven

I wrote my own page and put it on my own domain, so if I go
to http://www.mydomain.com/ip it returns the WAN IP for the
connection. It gets it from the environment variable of what IP
you're connecting from (requesting the page with), REMOTE_ADDR.
But the reason I maid my own is so it was easier to parse, mine just
returned the IP.

Steven

Mike said:
Thanks Mark for your quick response.
But when I go the website http://whatismyipaddress.com/ it does return my
correct IP address. There are other websites also which shows correct IP
address.
We are tring to capture this information and store it for some
troubleshooting later on.

How does other website caputures it?

Thanks, Mark
 
M

Mike

I understand your concern.
But most of our users may not know how to spoof IP address.
Also I just want to finish the task given to me. I don't want to argue with
my seniors on this as I already argued a lot recently on other subjects.

Is there any way to get the IP address?

Thanks Mark
 
B

bruce barker

as stated, you can only get the nat transalated address, but this may be
close enough. it sounds like your server is behind a firewall (or load
balancer), so the ipaddres your are currently getting is the firewall's
ipaddress. you will need to configure your firewall to pass along the
original ipadress in a custom header. then you can just the address form the
custom header.


-- bruce (sqlwork.com)
 
G

Gregory A. Beamer \(Cowboy\) - MVP

When you hit whats my ip, you are not spoofing and you might have a natted
internal address, but that is the address of your cable or DSL modem
(assumption here).

The other website is tearing down the header, just as ASP.NET does. You can
examine all of the keys. But, as Mark pointed out, the IP is relatively
meaningless if you are trying to use it to identify people (it changes) or
block hackers (they spoof), which are the primary reasons for gathering IP.

If you are sold on this idea:
Request.UserHostAddress()

Not sure if it will be any better for you.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
Mike said:
Thanks Mark for your quick response.
But when I go the website http://whatismyipaddress.com/ it does return my
correct IP address. There are other websites also which shows correct IP
address.
We are tring to capture this information and store it for some
troubleshooting later on.

How does other website caputures it?

Thanks, Mark
 
Ad

Advertisements

G

Gregory A. Beamer \(Cowboy\) - MVP

Try:
Request.UserHostAddress()

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
Mike said:
I understand your concern.
But most of our users may not know how to spoof IP address.
Also I just want to finish the task given to me. I don't want to argue
with my seniors on this as I already argued a lot recently on other
subjects.

Is there any way to get the IP address?

Thanks Mark
 
J

John Saunders

Mike said:
I understand your concern.
But most of our users may not know how to spoof IP address.
Also I just want to finish the task given to me. I don't want to argue
with my seniors on this as I already argued a lot recently on other
subjects.

Is there any way to get the IP address?

My IP address is 192.168.0.3. Several hundred thousand other computers
probably have the exact same IP address at this very moment.
http://whatismyipaddress.com/ reports my address as 72.74.111.34. It gives
the exact same address for my home PC, in the other room.

Which one am I?
 
G

Gregory A. Beamer \(Cowboy\) - MVP

Use Firefox and Firebug and see what headers you are sending. That will give
you a better shot of determining where you need to pull the value from.

Also consider iterating through all keys sent on the request object and see
if one contains the IP you desire. There is no guarantee that this value
will be accurate, of course, but you will find it in there, if it is there.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
Mike said:
I tried even that with same result.

Mark
 
Ad

Advertisements

G

Gregory A. Beamer \(Cowboy\) - MVP

Yes. I would argue with my boss first, as this requirement is completely
worthless IMO. But there are times you do "stupid" stuff, with proper
documentation, or you find a new job.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
 
Joined
Dec 26, 2012
Messages
1
Reaction score
0
Hi ASP Gurus,
Please help me solving my problem.
I am trying to get the clients IP address but I am not able to do it
successfully. I have tried:
Request.ServerVariables("http_user_agent")
Request.ServerVariable("remote_addr")

But I am getting something like '125.1.1*'

What do I need to get the IP address assigned my the ISP.

I'll appreciate any help you can provide.

Thanks, Mark

You can find your client ip address easily. Try the site A-Z Map of The World i hope it will provide you the correct ip address of your clients. By this you can get the ip address assigned by your ISP.
 
Last edited:
Ad

Advertisements

floppybootstomp

sugar 'n spikes
Moderator
Joined
Mar 5, 2002
Messages
20,250
Reaction score
1,753
Hiya kabi, the site you linked to charges for their service, there are free services available, look, here's one I used for you:

Which makes you a spammer.

Farewell, my little numpty friend :)
 

Attachments

  • kabi.JPG
    kabi.JPG
    104.6 KB · Views: 241
Status
Not open for further replies.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top