No, because message handlers work with raw HttpRequestMessage or raw HttpResponseMessage (if continued). So there really is no concept of a “current controller controller” with DelegatingHandlers , because message handlers will be called before sending a request to the controller or (again, in case of continuations) after the controller returns a response.
However, it really depends on what you are trying to do.
If you want to know which controller the request will be redirected to, you can manually call the mechanism that the controllers will internally select.
public class MyHandler : DelegatingHandler { protected override System.Threading.Tasks.Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { var config = GlobalConfiguration.Configuration; var controllerSelector = new DefaultHttpControllerSelector(config);
source share