How to get IP address in ASP.NET

Saturday, 4 July 2009 22:37 by scngan
One of the method to get your visitor IP address is by the following code :

' check for user IP address

Dim sIPAddress

sIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")

If sIPAddress = "" Then sIPAddress = Request.ServerVariables("REMOTE_ADDR")

lblIP.text = sIPAddress

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:   ,
Categories:   Technical Stuff
Actions:   | E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed
Comments are closed