How to get client IP address assigned by ISP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike

    #1

    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.ServerV ariables("http_ user_agent")
    Request.ServerV ariable("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


  • Mark Rae [MVP]

    #2
    Re: How to get client IP address assigned by ISP

    "Mike" <Mike@nospaml.c omwrote in message
    news:uPf6n5dNJH A.1472@TK2MSFTN GP03.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.ServerV ariables("http_ user_agent")
    Request.ServerV ariable("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


    Comment

    • Mike

      #3
      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@markNOSPA Mrae.netwrote in message
      news:uX0HG$dNJH A.4404@TK2MSFTN GP03.phx.gbl...
      "Mike" <Mike@nospaml.c omwrote in message
      news:uPf6n5dNJH A.1472@TK2MSFTN GP03.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.Server Variables("http _user_agent")
      >Request.Server Variable("remot e_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

      Comment

      • Steven

        #4
        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.c omwrote in message
        news:Oi3mNKeNJH A.2484@TK2MSFTN GP06.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]" <mark@markNOSPA Mrae.netwrote in message
        news:uX0HG$dNJH A.4404@TK2MSFTN GP03.phx.gbl...
        >"Mike" <Mike@nospaml.c omwrote in message
        >news:uPf6n5dNJ HA.1472@TK2MSFT NGP03.phx.gbl.. .
        >>
        >>I am trying to get the client's IP address but I am not able to do it
        >>successfull y. I have tried:
        >>Request.Serve rVariables("htt p_user_agent")
        >>Request.Serve rVariable("remo te_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
        >
        >

        Comment

        • Mark Rae [MVP]

          #5
          Re: How to get client IP address assigned by ISP

          "Mike" <Mike@nospaml.c omwrote in message
          news:Oi3mNKeNJH A.2484@TK2MSFTN GP06.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


          Comment

          • Mike

            #6
            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@markNOSPA Mrae.netwrote in message
            news:OXEN3geNJH A.4760@TK2MSFTN GP02.phx.gbl...
            "Mike" <Mike@nospaml.c omwrote in message
            news:Oi3mNKeNJH A.2484@TK2MSFTN GP06.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
            >troubleshootin g 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

            Comment

            • =?Utf-8?B?YnJ1Y2UgYmFya2Vy?=

              #7
              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:
              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.ServerV ariables("http_ user_agent")
              Request.ServerV ariable("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
              >
              >
              >

              Comment

              • Gregory A. Beamer \(Cowboy\) - MVP

                #8
                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.UserHos tAddress()

                Not sure if it will be any better for you.

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

                Subscribe to my blog


                or just read it:


                *************** *************** **************
                | Think outside the box! |
                *************** *************** **************
                "Mike" <Mike@nospaml.c omwrote in message
                news:Oi3mNKeNJH A.2484@TK2MSFTN GP06.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]" <mark@markNOSPA Mrae.netwrote in message
                news:uX0HG$dNJH A.4404@TK2MSFTN GP03.phx.gbl...
                >"Mike" <Mike@nospaml.c omwrote in message
                >news:uPf6n5dNJ HA.1472@TK2MSFT NGP03.phx.gbl.. .
                >>
                >>I am trying to get the client's IP address but I am not able to do it
                >>successfull y. I have tried:
                >>Request.Serve rVariables("htt p_user_agent")
                >>Request.Serve rVariable("remo te_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
                >
                >

                Comment

                • Gregory A. Beamer \(Cowboy\) - MVP

                  #9
                  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


                  or just read it:


                  *************** *************** **************
                  | Think outside the box! |
                  *************** *************** **************
                  "Mike" <Mike@nospaml.c omwrote in message
                  news:uPf6n5dNJH A.1472@TK2MSFTN GP03.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.ServerV ariables("http_ user_agent")
                  Request.ServerV ariable("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
                  >
                  >

                  Comment

                  • Gregory A. Beamer \(Cowboy\) - MVP

                    #10
                    Re: How to get client IP address assigned by ISP

                    Try:
                    Request.UserHos tAddress()

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

                    Subscribe to my blog


                    or just read it:


                    *************** *************** **************
                    | Think outside the box! |
                    *************** *************** **************
                    "Mike" <Mike@nospaml.c omwrote in message
                    news:erVTLteNJH A.2484@TK2MSFTN GP06.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]" <mark@markNOSPA Mrae.netwrote in message
                    news:OXEN3geNJH A.4760@TK2MSFTN GP02.phx.gbl...
                    >"Mike" <Mike@nospaml.c omwrote in message
                    >news:Oi3mNKeNJ HA.2484@TK2MSFT NGP06.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
                    >>troubleshooti ng 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
                    >
                    >

                    Comment

                    • Mark Rae [MVP]

                      #11
                      Re: How to get client IP address assigned by ISP

                      "Gregory A. Beamer (Cowboy) - MVP" <NoSpamMgbworld @comcast.netNoS pamMwrote
                      in message news:OhvqH6eNJH A.1552@TK2MSFTN GP03.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.UserHos tAddress()
                      And hope for the best!


                      --
                      Mark Rae
                      ASP.NET MVP


                      Comment

                      • Mike

                        #12
                        Re: How to get client IP address assigned by ISP

                        I tried even that with same result.

                        Mark

                        "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message
                        news:Od1rZ8eNJH A.3876@TK2MSFTN GP04.phx.gbl...
                        "Gregory A. Beamer (Cowboy) - MVP" <NoSpamMgbworld @comcast.netNoS pamM>
                        wrote in message news:OhvqH6eNJH A.1552@TK2MSFTN GP03.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.UserHo stAddress()
                        >
                        And hope for the best!
                        >
                        >
                        --
                        Mark Rae
                        ASP.NET MVP
                        http://www.markrae.net

                        Comment

                        • John Saunders

                          #13
                          Re: How to get client IP address assigned by ISP



                          "Mike" <Mike@nospaml.c omwrote in message
                          news:erVTLteNJH A.2484@TK2MSFTN GP06.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

                          Comment

                          • Gregory A. Beamer \(Cowboy\) - MVP

                            #14
                            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


                            or just read it:


                            *************** *************** **************
                            | Think outside the box! |
                            *************** *************** **************
                            "Mike" <Mike@nospaml.c omwrote in message
                            news:efuWbBfNJH A.4760@TK2MSFTN GP02.phx.gbl...
                            >I tried even that with same result.
                            >
                            Mark
                            >
                            "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message
                            news:Od1rZ8eNJH A.3876@TK2MSFTN GP04.phx.gbl...
                            >"Gregory A. Beamer (Cowboy) - MVP" <NoSpamMgbworld @comcast.netNoS pamM>
                            >wrote in message news:OhvqH6eNJH A.1552@TK2MSFTN GP03.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.UserH ostAddress()
                            >>
                            >And hope for the best!
                            >>
                            >>
                            >--
                            >Mark Rae
                            >ASP.NET MVP
                            >http://www.markrae.net
                            >
                            >

                            Comment

                            • Gregory A. Beamer \(Cowboy\) - MVP

                              #15
                              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


                              or just read it:


                              *************** *************** **************
                              | Think outside the box! |
                              *************** *************** **************
                              "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message
                              news:Od1rZ8eNJH A.3876@TK2MSFTN GP04.phx.gbl...
                              "Gregory A. Beamer (Cowboy) - MVP" <NoSpamMgbworld @comcast.netNoS pamM>
                              wrote in message news:OhvqH6eNJH A.1552@TK2MSFTN GP03.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.UserHo stAddress()
                              >
                              And hope for the best!
                              >
                              >
                              --
                              Mark Rae
                              ASP.NET MVP
                              http://www.markrae.net

                              Comment

                              Working...