tags:

views:

88

answers:

2

I have tried fetching the ip from below mentioned methods

HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] & 
Request.UserHostAddress & Request.ServerVariables["REMOTE_ADDR"]

The problem is this that Request.ServerVariables["REMOTE_ADDR"] return Proxy ip and HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] can be tampered i want a foolproof method of fetching ip of client which cannot be tampered any help in this regard would be highly appreciated.

+8  A: 

i want a foolproof method of fetching ip of client which cannot be tampered

Does not exist. Sorry.

The problem is this that Request.ServerVariables["REMOTE_ADDR"] return Proxy ip

Suppose the user is behind the corporate proxy. You'll be getting this proxy IP which for all intents and purposes is the closest thing to the user's IP. I mean if you got the user's final internal IP like 192.168.0.15 of what use would that be to you?

Developer Art
I don't think you need to apologise for how the internets work :P
annakata
Isn't their any way to find out User ip address as in if a client request a web page from proxy server i want to know the internet ip address of that proxy server and not the internal ip address which client cannot tamper.
azimyasin
I happen to get Corporate proxy internal ip address not internet ip address with that.
azimyasin
+2  A: 

In addition to @Developer Art, consider the fact that many of the IP addresses on the internet are proxied from private class 'C' addresses. As an example, though my cable modem at home has a public IP address, my router provides a proxy for an internal Class C address (e.g. 192.168.1.123).

Finally... Given that 192. and 10. addresses are the norm for most consumer routers, the majority of your users would be coming through with an address that starts with one of those two numbers, and would not, by any measure, be unique.

Robaticus