You are on the right track with REMOTE_ADDR, but it may not work, if you visit the site locally, it will show the local host.
REMOTE_ADDR is a header containing the IP address of the client that you should check first.
HTTP_X_FORWARDED, . , HTTP_X_FORWARDED - , , , .
#, ip:
string clientIp = context.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if( !string.IsNullOrEmpty(clientIp) ) {
string[] forwardedIps = clientIp.Split( new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries );
clientIp = forwardedIps[forwardedIps.Length - 1];
} else {
clientIp = context.Request.ServerVariables["REMOTE_ADDR"];
}