HttpContextAccessor.HttpContext.GetRouteData not have definition

Viewed 38

In dotnet core 6 service (class library) I am accessing HttpContextAccessor.HttpContext.GetRouteData() but it says it does not contains definition for GetRouteData.

Any help on this.

Thanks.

1 Answers

GetRouteData() is an extension method in namespace Microsoft.AspNetCore.Routing.

You have to add using Microsoft.AspNetCore.Routing;

Related