Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to Get Local Area IP Address?

How to Get Local Area IP Address?

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-nethelptutorial
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nandan Basak
    wrote on last edited by
    #1

    How can i get all IP addresses which connected in LAN using ASP.NET // Private Function GetIP4Address() As String Dim IP4Address As String = [String].Empty For Each IPA As IPAddress In Dns.GetHostAddresses(Dns.GetHostName()) If IPA.AddressFamily.ToString() = "InterNetwork" Then IP4Address = IPA.ToString() Exit For End If Next Return IP4Address End Function // I'm using this function but it returns only my IP address. Please help me... Thanks in advance...

    N B R 3 Replies Last reply
    0
    • N Nandan Basak

      How can i get all IP addresses which connected in LAN using ASP.NET // Private Function GetIP4Address() As String Dim IP4Address As String = [String].Empty For Each IPA As IPAddress In Dns.GetHostAddresses(Dns.GetHostName()) If IPA.AddressFamily.ToString() = "InterNetwork" Then IP4Address = IPA.ToString() Exit For End If Next Return IP4Address End Function // I'm using this function but it returns only my IP address. Please help me... Thanks in advance...

      N Offline
      N Offline
      n podbielski
      wrote on last edited by
      #2

      So you want to list all machines i LAN?

      No more Mister Nice Guy... >: |

      1 Reply Last reply
      0
      • N Nandan Basak

        How can i get all IP addresses which connected in LAN using ASP.NET // Private Function GetIP4Address() As String Dim IP4Address As String = [String].Empty For Each IPA As IPAddress In Dns.GetHostAddresses(Dns.GetHostName()) If IPA.AddressFamily.ToString() = "InterNetwork" Then IP4Address = IPA.ToString() Exit For End If Next Return IP4Address End Function // I'm using this function but it returns only my IP address. Please help me... Thanks in advance...

        B Offline
        B Offline
        Bernhard Hiller
        wrote on last edited by
        #3

        The first thing you ought to learn is: differenciate between code executed on the server and code executed on the client (user site). You say you are using ASP.NET - just think: where is that code executed? And another thing you ought to learn: there are many security mechanisms when it comes to code (JavaScript etc.) running in a web browser! Why should anyone want to allow you to find out which other IP addresses are used in his local (private) network? Because he wants to make a virus/worm attack easy for some hacker?

        N 1 Reply Last reply
        0
        • N Nandan Basak

          How can i get all IP addresses which connected in LAN using ASP.NET // Private Function GetIP4Address() As String Dim IP4Address As String = [String].Empty For Each IPA As IPAddress In Dns.GetHostAddresses(Dns.GetHostName()) If IPA.AddressFamily.ToString() = "InterNetwork" Then IP4Address = IPA.ToString() Exit For End If Next Return IP4Address End Function // I'm using this function but it returns only my IP address. Please help me... Thanks in advance...

          R Offline
          R Offline
          rameshkashanna
          wrote on last edited by
          #4

          Dim ipaddress As String = HttpContext.Current.Request.UserHostAddress by using this we can get client ip address and Dim ipaddress As String = HttpContext.Current.Request.UserHostName by using this we can get client host name

          N 1 Reply Last reply
          0
          • B Bernhard Hiller

            The first thing you ought to learn is: differenciate between code executed on the server and code executed on the client (user site). You say you are using ASP.NET - just think: where is that code executed? And another thing you ought to learn: there are many security mechanisms when it comes to code (JavaScript etc.) running in a web browser! Why should anyone want to allow you to find out which other IP addresses are used in his local (private) network? Because he wants to make a virus/worm attack easy for some hacker?

            N Offline
            N Offline
            Nandan Basak
            wrote on last edited by
            #5

            Thank you sir , but i want to know only that IP address which are connected Client site LAN only.Is it possible?

            1 Reply Last reply
            0
            • R rameshkashanna

              Dim ipaddress As String = HttpContext.Current.Request.UserHostAddress by using this we can get client ip address and Dim ipaddress As String = HttpContext.Current.Request.UserHostName by using this we can get client host name

              N Offline
              N Offline
              Nandan Basak
              wrote on last edited by
              #6

              Thanks ......Its working.

              N.K.Basak

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups