private static string GetXForwardedAddress()
{
string clientip = null;
var xff = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (!string.IsNullOrEmpty(xff))
{
string[] parts = xff.Split(',');
if (parts.Length > 0)
{
clientip = parts[0].Trim();
}
}
return clientip;
}