How to get an IPAddress from within a CodeBehind aspx page
Posted on 2012-03-12
I am trying to get the users IPAddress....from within a CodeBehind aspx page.
This is on my aspx page... test.aspx
which refers to --> CodeBehind="test.aspx.vb"
My function is this.....(inside test.aspx.vb)
Public Shared Function getIPAddress()
Dim IPAddress As String = ""
IPAddress = Request.ServerVariables("REMOTE_ADDR")
The error I get is this.....
Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.
Can I get the IPAddress directly from inside the CodeBehind page?
Can I get it from the aspx page & pass it to the CodeBehind page?