Click or drag to resize

HttpContextExtensionsRemoteHostAddress Method

Returns the proper UserHostAddress from the request. The first path is to look for the X-Forwarded-For header and take the last IP address in that list.

Namespace:  NetQuarry
Assembly:  EAP.Core (in EAP.Core.dll) Version: 2.0.0.0 (4.6.8.0)
Syntax
public static string RemoteHostAddress(
	this HttpContext context
)

Parameters

context
Type: System.WebHttpContext
The HttpContext.Current object.

Return Value

Type: String
The IP address of the user as reported by the request.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type HttpContext. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also