ActionContext gone in Microsoft.AspNetCore.Mvc.Controller
In .NET core 3.1 at least, ControllerBase has a property Url that works as a UrlHelper so you don't have to make one yourself. https://stackoverflow.com/a/52537244/4172413
I replaced ActionContext with ControllerContext, and it works for me. I don't know if it's an official migration step, though.
You can inject IActionContextAccessor
to your class. It provides access to the action context.
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
Use it:
private readonly IActionContextAccessor actionContextAccessor
public FooController(IActionContextAccessor actionContextAccessor)
{
this.actionContextAccessor = actionContextAccessor;
}
See this issue.