string userHost = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (String.IsNullOrEmpty(userHost) || String.Compare(userHost, "unknown", true) == 0){ userHost = Request.UserHostAddress;}