digitalpower
BANNED
- Dec 16, 2008
- 303
- 70
In case you want to do some simple user tracking on your ASP.NET website, you can use this function to get the current user's IP address.
Code:
Public Shared Function GetIPAddress() As String
Dim sIPAddress As String
sIPAddress = HttpContext.Current.Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If sIPAddress = "" Then
sIPAddress = HttpContext.Current.Request.ServerVariables("REMOTE_ADDR")
End If
Return sIPAddress
End Function