ServerVariables["REMOTE_ADDR"]

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
i am trying to get the user ip address with ServerVariables["REMOTE_ADDR"].
for some reason i'm getting "::1" instead of the ip.

the weird thing is:
when i run it with Visual Studio 2008 on a web project it works fine.
on Visual studio 2010 it does not work

i even open a 2008 project (that was working fine) with 2010 converted the files, left the framework on 3.5)
and it did not work.

even set the frame work to 3.5 on VS 2010 and still not working
also tried it on a single webform again 2008 working 2010 not working

same thing for  Request.UserHostAddress

anyone?


protected void Page_Load(object sender, EventArgs e)
        {
            
            Response.Write(Request.ServerVariables["REMOTE_ADDR"]);
        }

working on VS 2008 does not work on VS 2010
12 years ago
::1 means localhost as IPv6. Is it normal and not an error. If your webserver has IPv6 enabled and you hit the website using localhost, you're going to get ::1.
12 years ago
thank you
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.