The code given below gives you the IP address of the User Accessing the site.
1) HttpContext.Current.Request.UserHostAddress;
OR
2) HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
To get the IP Address of the machine and not the proxy use the following code:
1) HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
1) HttpContext.Current.Request.UserHostAddress;
OR
2) HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
To get the IP Address of the machine and not the proxy use the following code:
1) HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
This comment has been removed by the author.
ReplyDeleteWelcome...
ReplyDelete