EndpointHttpContextExtensions.GetEndpoint(HttpContext) Method

Definition

Extension method for getting the Endpoint for the current request.

C#
public static Microsoft.AspNetCore.Http.Endpoint GetEndpoint (this Microsoft.AspNetCore.Http.HttpContext context);
C#
public static Microsoft.AspNetCore.Http.Endpoint? GetEndpoint (this Microsoft.AspNetCore.Http.HttpContext context);

Parameters

context
HttpContext

The HttpContext context.

Returns

The Endpoint or null if the request doesn't have an endpoint.

Remarks

The endpoint for a request is typically set by routing middleware. A request might not have an endpoint if routing middleware hasn't run yet, or the request didn't match a route.

Applies to

Product Versions
ASP.NET Core 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0