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 | | | | re: How to get client IP address assigned by ISP
"Mike" <Mike@nospaml.comwrote in message
news:uPf6n5dNJHA.1472@TK2MSFTNGP03.phx.gbl... Quote:
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 | | | | re: How to get client IP address assigned by ISP
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]" <mark@markNOSPAMrae.netwrote in message
news:uX0HG$dNJHA.4404@TK2MSFTNGP03.phx.gbl... Quote:
"Mike" <Mike@nospaml.comwrote in message
news:uPf6n5dNJHA.1472@TK2MSFTNGP03.phx.gbl...
> Quote:
>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 | | | | re: How to get client IP address assigned by ISP
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" <Mike@nospaml.comwrote in message
news:Oi3mNKeNJHA.2484@TK2MSFTNGP06.phx.gbl... Quote:
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]" <mark@markNOSPAMrae.netwrote in message
news:uX0HG$dNJHA.4404@TK2MSFTNGP03.phx.gbl... Quote:
>"Mike" <Mike@nospaml.comwrote in message
>news:uPf6n5dNJHA.1472@TK2MSFTNGP03.phx.gbl...
>> Quote:
>>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 >
>
| | | | re: How to get client IP address assigned by ISP
"Mike" <Mike@nospaml.comwrote in message
news:Oi3mNKeNJHA.2484@TK2MSFTNGP06.phx.gbl... Quote: Quote: Quote:
>>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. Quote:
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 | | | | re: How to get client IP address assigned by ISP
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]" <mark@markNOSPAMrae.netwrote in message
news:OXEN3geNJHA.4760@TK2MSFTNGP02.phx.gbl... Quote:
"Mike" <Mike@nospaml.comwrote in message
news:Oi3mNKeNJHA.2484@TK2MSFTNGP06.phx.gbl...
> Quote: Quote:
>>>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.
> Quote:
>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 | | | | re: How to get client IP address assigned by ISP
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: Quote:
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
>
>
>
| | | | re: How to get client IP address assigned by ISP
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" <Mike@nospaml.comwrote in message
news:Oi3mNKeNJHA.2484@TK2MSFTNGP06.phx.gbl... Quote:
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]" <mark@markNOSPAMrae.netwrote in message
news:uX0HG$dNJHA.4404@TK2MSFTNGP03.phx.gbl... Quote:
>"Mike" <Mike@nospaml.comwrote in message
>news:uPf6n5dNJHA.1472@TK2MSFTNGP03.phx.gbl...
>> Quote:
>>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 >
>
| | | | re: How to get client IP address assigned by ISP
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" <Mike@nospaml.comwrote in message
news:uPf6n5dNJHA.1472@TK2MSFTNGP03.phx.gbl... Quote:
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
>
>
| | | | re: How to get client IP address assigned by ISP
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" <Mike@nospaml.comwrote in message
news:erVTLteNJHA.2484@TK2MSFTNGP06.phx.gbl... Quote:
>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]" <mark@markNOSPAMrae.netwrote in message
news:OXEN3geNJHA.4760@TK2MSFTNGP02.phx.gbl... Quote:
>"Mike" <Mike@nospaml.comwrote in message
>news:Oi3mNKeNJHA.2484@TK2MSFTNGP06.phx.gbl...
>> Quote:
>>>>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.
>> Quote:
>>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 >
>
| | | | re: How to get client IP address assigned by ISP
"Gregory A. Beamer (Cowboy) - MVP" <NoSpamMgbworld@comcast.netNoSpamMwrote
in message news:OhvqH6eNJHA.1552@TK2MSFTNGP03.phx.gbl... Quote: Quote:
>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 | | | | re: How to get client IP address assigned by ISP
I tried even that with same result.
Mark
"Mark Rae [MVP]" <mark@markNOSPAMrae.netwrote in message
news:Od1rZ8eNJHA.3876@TK2MSFTNGP04.phx.gbl... Quote:
"Gregory A. Beamer (Cowboy) - MVP" <NoSpamMgbworld@comcast.netNoSpamM>
wrote in message news:OhvqH6eNJHA.1552@TK2MSFTNGP03.phx.gbl...
> Quote: Quote:
>>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 | | | | re: How to get client IP address assigned by ISP
"Mike" <Mike@nospaml.comwrote in message
news:erVTLteNJHA.2484@TK2MSFTNGP06.phx.gbl... Quote:
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 | | | | re: How to get client IP address assigned by ISP
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" <Mike@nospaml.comwrote in message
news:efuWbBfNJHA.4760@TK2MSFTNGP02.phx.gbl... Quote:
>I tried even that with same result.
>
Mark
>
"Mark Rae [MVP]" <mark@markNOSPAMrae.netwrote in message
news:Od1rZ8eNJHA.3876@TK2MSFTNGP04.phx.gbl... Quote:
>"Gregory A. Beamer (Cowboy) - MVP" <NoSpamMgbworld@comcast.netNoSpamM>
>wrote in message news:OhvqH6eNJHA.1552@TK2MSFTNGP03.phx.gbl...
>> Quote:
>>>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 >
>
| | | | re: How to get client IP address assigned by ISP
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]" <mark@markNOSPAMrae.netwrote in message
news:Od1rZ8eNJHA.3876@TK2MSFTNGP04.phx.gbl... Quote:
"Gregory A. Beamer (Cowboy) - MVP" <NoSpamMgbworld@comcast.netNoSpamM>
wrote in message news:OhvqH6eNJHA.1552@TK2MSFTNGP03.phx.gbl...
> Quote: Quote:
>>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 | | | | re: How to get client IP address assigned by ISP
"Mike" <Mike@nospaml.comwrote in message
news:efuWbBfNJHA.4760@TK2MSFTNGP02.phx.gbl... Quote: Quote: Quote:
>>>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 |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,272 network members.
|