Wednesday, April 8, 2009

Get Client IP address

Public Shared Function GetClientIPAddress() As String

Dim strIpAddress As String

Try

strIpAddress = HttpContext.Current.Request.ServerVariables("HTTP_X_FORWARDED_FOR")

If strIpAddress = "" Then

strIpAddress = HttpContext.Current.Request.ServerVariables("REMOTE_ADDR")

End If

Catch

strIpAddress = ""

End Try

Return strIpAddress

End Function


blog comments powered by Disqus