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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. get the client hostname or ip address using asp.net

get the client hostname or ip address using asp.net

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nethelptutorialquestion
2 Posts 2 Posters 1 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.
  • R Offline
    R Offline
    Ramamurthi
    wrote on last edited by
    #1

    Hi, I want to get the client hostname or ip address using asp.net. I have tried the following methods... Request.UserHostName - returns proxy ip address Request.UserHostAddress - returns proxy ip address Request.ServerVariables["REMOTE_ADDR"] - returns proxy ip address Request.ServerVariables["HTTP_X_FORWARDED_FOR"] - returns empty. I could not get the actual ip address of the client machine. Can any one help...how to get the actual client ip address? Thanks in advance. Ram

    F 1 Reply Last reply
    0
    • R Ramamurthi

      Hi, I want to get the client hostname or ip address using asp.net. I have tried the following methods... Request.UserHostName - returns proxy ip address Request.UserHostAddress - returns proxy ip address Request.ServerVariables["REMOTE_ADDR"] - returns proxy ip address Request.ServerVariables["HTTP_X_FORWARDED_FOR"] - returns empty. I could not get the actual ip address of the client machine. Can any one help...how to get the actual client ip address? Thanks in advance. Ram

      F Offline
      F Offline
      Felipe Dalorzo
      wrote on last edited by
      #2

      Try this: string hostName= System.Net.Dns.GetHostName() string ipAddress = System.Net.Dns.GetHostAddresses(hostName)(0).ToString() Felipe

      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