[ACCEPTED]-ip address of request from httpheader-ip-address

Accepted answer
Score: 12

Does this help? it seems pretty straight forward.

From 1 the link, there are a few different ways:

HttpContext.Current.Request.UserHostAddress;

HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];

HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

Score: 7

You might want to look here. The HTTP standards do 12 not define the source address as part of 11 the protocol. Infact HTTP does not directly 10 relate to IPv4 /IPv6 at all.

Generally, a 9 webserver will easily be able to tell the 8 network address of the other end of the 7 socket ( the end where the web browser is 6 ). It does not use HTTP to do this, rather 5 it will use features of the OS's networking 4 stack.

In the case of ASP.NET you should 3 be able to find the IP address where the 2 request came from. You might try looking 1 at System.Web.HttpRequest.UserHostAddress

More Related questions