473,385 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to get client IP address assigned by ISP

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
Oct 24 '08 #1
15 15593
"Mike" <Mi**@nospaml.comwrote in message
news:uP**************@TK2MSFTNGP03.phx.gbl...
I am trying to get the client's 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.
This question comes up fairly regularly.

There is no 100% reliable way to get a client's IP address, for several
reasons. As you've already discovered, if the client is behind a router, or
a proxy server, or using NAT, then you won't see their true IP address -
there is no way round this.

Also, IP addresses are laughably easy to spoof...

For these reasons, IP addresses are completely meaningless - there's no
point in even trying to use them for anything meaningful...

Why are you trying to get the client's IP address, AAMOI...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 24 '08 #2
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
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:uX**************@TK2MSFTNGP03.phx.gbl...
"Mike" <Mi**@nospaml.comwrote in message
news:uP**************@TK2MSFTNGP03.phx.gbl...
>I am trying to get the client's 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.

This question comes up fairly regularly.

There is no 100% reliable way to get a client's IP address, for several
reasons. As you've already discovered, if the client is behind a router,
or a proxy server, or using NAT, then you won't see their true IP
address - there is no way round this.

Also, IP addresses are laughably easy to spoof...

For these reasons, IP addresses are completely meaningless - there's no
point in even trying to use them for anything meaningful...

Why are you trying to get the client's IP address, AAMOI...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 24 '08 #3
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" <Mi**@nospaml.comwrote in message
news:Oi**************@TK2MSFTNGP06.phx.gbl...
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
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:uX**************@TK2MSFTNGP03.phx.gbl...
>"Mike" <Mi**@nospaml.comwrote in message
news:uP**************@TK2MSFTNGP03.phx.gbl...
>>I am trying to get the client's 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.

This question comes up fairly regularly.

There is no 100% reliable way to get a client's IP address, for several
reasons. As you've already discovered, if the client is behind a router,
or a proxy server, or using NAT, then you won't see their true IP
address - there is no way round this.

Also, IP addresses are laughably easy to spoof...

For these reasons, IP addresses are completely meaningless - there's no
point in even trying to use them for anything meaningful...

Why are you trying to get the client's IP address, AAMOI...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net


Oct 24 '08 #4
"Mike" <Mi**@nospaml.comwrote in message
news:Oi**************@TK2MSFTNGP06.phx.gbl...
>>What do I need to get the IP address assigned my the ISP.

This question comes up fairly regularly.

There is no 100% reliable way to get a client's IP address, for several
reasons. As you've already discovered, if the client is behind a router,
or a proxy server, or using NAT, then you won't see their true IP
address - there is no way round this.

Also, IP addresses are laughably easy to spoof...

For these reasons, IP addresses are completely meaningless - there's no
point in even trying to use them for anything meaningful...

Why are you trying to get the client's IP address, AAMOI...?

But when I go the website http://whatismyipaddress.com/ it does return my
correct IP address.
Of course it does! Because you're not behind a proxy server, and you're not
spoofing your IP address.
We are trying to capture this information and store it for some
troubleshooting later on.
Complete waste of time, as I've already explained... Supposing I access your
website, but I spoof my IP address? What use would the IP address be to you?
What if I pretend that my IP address is 65.115.199.90? Who would you contact
then?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 24 '08 #5
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

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:OX**************@TK2MSFTNGP02.phx.gbl...
"Mike" <Mi**@nospaml.comwrote in message
news:Oi**************@TK2MSFTNGP06.phx.gbl...
>>>What do I need to get the IP address assigned my the ISP.

This question comes up fairly regularly.

There is no 100% reliable way to get a client's IP address, for several
reasons. As you've already discovered, if the client is behind a router,
or a proxy server, or using NAT, then you won't see their true IP
address - there is no way round this.

Also, IP addresses are laughably easy to spoof...

For these reasons, IP addresses are completely meaningless - there's no
point in even trying to use them for anything meaningful...

Why are you trying to get the client's IP address, AAMOI...?

But when I go the website http://whatismyipaddress.com/ it does return my
correct IP address.

Of course it does! Because you're not behind a proxy server, and you're
not spoofing your IP address.
>We are trying to capture this information and store it for some
troubleshooting later on.

Complete waste of time, as I've already explained... Supposing I access
your website, but I spoof my IP address? What use would the IP address be
to you?
What if I pretend that my IP address is 65.115.199.90? Who would you
contact then?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 24 '08 #6

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)
"Mike" wrote:
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
Oct 24 '08 #7
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" <Mi**@nospaml.comwrote in message
news:Oi**************@TK2MSFTNGP06.phx.gbl...
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
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:uX**************@TK2MSFTNGP03.phx.gbl...
>"Mike" <Mi**@nospaml.comwrote in message
news:uP**************@TK2MSFTNGP03.phx.gbl...
>>I am trying to get the client's 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.

This question comes up fairly regularly.

There is no 100% reliable way to get a client's IP address, for several
reasons. As you've already discovered, if the client is behind a router,
or a proxy server, or using NAT, then you won't see their true IP
address - there is no way round this.

Also, IP addresses are laughably easy to spoof...

For these reasons, IP addresses are completely meaningless - there's no
point in even trying to use them for anything meaningful...

Why are you trying to get the client's IP address, AAMOI...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net


Oct 24 '08 #8
One thing I would consider is use Firefox and a add in like FireBug to see
the actual headers you are sending. You may be just sending 125.1.1*

--
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" <Mi**@nospaml.comwrote in message
news:uP**************@TK2MSFTNGP03.phx.gbl...
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


Oct 24 '08 #9
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" <Mi**@nospaml.comwrote in message
news:er**************@TK2MSFTNGP06.phx.gbl...
>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

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:OX**************@TK2MSFTNGP02.phx.gbl...
>"Mike" <Mi**@nospaml.comwrote in message
news:Oi**************@TK2MSFTNGP06.phx.gbl...
>>>>What do I need to get the IP address assigned my the ISP.

This question comes up fairly regularly.

There is no 100% reliable way to get a client's IP address, for several
reasons. As you've already discovered, if the client is behind a
router, or a proxy server, or using NAT, then you won't see their true
IP address - there is no way round this.

Also, IP addresses are laughably easy to spoof...

For these reasons, IP addresses are completely meaningless - there's no
point in even trying to use them for anything meaningful...

Why are you trying to get the client's IP address, AAMOI...?

But when I go the website http://whatismyipaddress.com/ it does return
my correct IP address.

Of course it does! Because you're not behind a proxy server, and you're
not spoofing your IP address.
>>We are trying to capture this information and store it for some
troubleshooting later on.

Complete waste of time, as I've already explained... Supposing I access
your website, but I spoof my IP address? What use would the IP address be
to you?
What if I pretend that my IP address is 65.115.199.90? Who would you
contact then?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net


Oct 24 '08 #10
"Gregory A. Beamer (Cowboy) - MVP" <No************@comcast.netNoSpamMwrote
in message news:Oh**************@TK2MSFTNGP03.phx.gbl...
>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?

Try:
Request.UserHostAddress()
And hope for the best!
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 24 '08 #11
I tried even that with same result.

Mark

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:Od**************@TK2MSFTNGP04.phx.gbl...
"Gregory A. Beamer (Cowboy) - MVP" <No************@comcast.netNoSpamM>
wrote in message news:Oh**************@TK2MSFTNGP03.phx.gbl...
>>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?

Try:
Request.UserHostAddress()

And hope for the best!
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 24 '08 #12


"Mike" <Mi**@nospaml.comwrote in message
news:er**************@TK2MSFTNGP06.phx.gbl...
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?

--
John Saunders | MVP - Connected System Developer

Oct 24 '08 #13
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" <Mi**@nospaml.comwrote in message
news:ef**************@TK2MSFTNGP02.phx.gbl...
>I tried even that with same result.

Mark

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:Od**************@TK2MSFTNGP04.phx.gbl...
>"Gregory A. Beamer (Cowboy) - MVP" <No************@comcast.netNoSpamM>
wrote in message news:Oh**************@TK2MSFTNGP03.phx.gbl...
>>>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?

Try:
Request.UserHostAddress()

And hope for the best!
--
Mark Rae
ASP.NET MVP
http://www.markrae.net


Oct 24 '08 #14
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! |
********************************************
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:Od**************@TK2MSFTNGP04.phx.gbl...
"Gregory A. Beamer (Cowboy) - MVP" <No************@comcast.netNoSpamM>
wrote in message news:Oh**************@TK2MSFTNGP03.phx.gbl...
>>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?

Try:
Request.UserHostAddress()

And hope for the best!
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 24 '08 #15
"Mike" <Mi**@nospaml.comwrote in message
news:ef**************@TK2MSFTNGP02.phx.gbl...
>>>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?

Try:
Request.UserHostAddress()

And hope for the best!

I tried even that with same result.
Yes, it would...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 24 '08 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: none | last post by:
I want to determine the outside (non local, a.k.a. 127.0.0.x) ip addresses of my host. It seems that the socket module provides me with some nifty tools for that but I cannot get it to work...
9
by: cppsks | last post by:
Taking the address of a static const resulted in a unresolved symbol. Why is that? Is the address assigned at load time? Thanks.
2
by: James Bond 007 | last post by:
I want to extract the user's IP address and put it into my form without him/her knowing about it. I have Javascript code (see below) to get the user's "start time", which works just fine (i.e.,...
7
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of...
1
by: Steve | last post by:
Hi all Ok then I have searched through the back postings for a while now on google and read some interesting stuff on how to model a typical client / order db however.... My problem is that I...
3
by: Demetri | last post by:
How do I find out what the network IP address is? For example if I have a cable modem with 68.57.200.50 as the IP address and the linksys router assigns PC's on the network 192.168.1.1 how do I...
11
by: Brian Henry | last post by:
I have a domain cluster with AD running, and I want to lookup a users email address (exchange 2000 server is integrated with the AD system) so i can email the user based on their user name. does...
3
by: billie | last post by:
Hi all. I'm searching for a module that permits me to low-level interact with ethernet interfaces of my system. I would like to determine at least the first of the followings values: 1 - IP...
1
by: Jan Danielsson | last post by:
Hello all, I writing an application based on the SimpleXMLRPCServer class. I would like to know the IP address of the client performing the RPC. Is that possible, without having to abandon the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.