How to get IP address in ASP.NET

July 4, 2009 at 10:37 PM
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

Posted in: Technical Stuff

Tags: ,