Skip to content

@karlseguin /gist:782799
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
try to bust through proxies for a remote address
private static readonly string[] _ipHeaderOrder = new[] { "HTTP_X_FORWARDED_FOR", "HTTP_X_CLUSTER_CLIENT_IP", "REMOTE_ADDR" };
public static string ClientAddress(this HttpRequest request)
{
foreach (string header in _ipHeaderOrder)
{
string ipAddress = request.ServerVariables[header];
if (ipAddress != null)
{
return ipAddress;
}
}
return string.Empty;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.