It is not possible to change the behavior of the UserHostAddress property, however, what you can do is add an extension method to the Request class (something like GetRealUserHostAddress ()) and just make a global replacement with UserHostAddress → GetRealUserHostAddress () to quickly sort all instances in your solution .
public static string GetRealUserHostAddress(this HttpRequestBase request) { return request.Headers["HeaderName"] ?? request.UserHostAddress; }
source share