When we are logging the website we also want to log the user
IP address.
The below given code gives you the IP address of the User
Accessing the site.
HttpContext.Current.Request.UserHostAddress;
or
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
To get the IP address of the machine and not the proxy use
the following code
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
Hope this helps
Thanks
Vikram