0

I facing a big problem when using HttpClientFactory in ActionFilterAttribute. From Microsoft docuemnt HttpClientFactory I need to register it in Startup.ConfigureServices method. When I use the HttpClientFactory that I just need to declare it in Controller

public TestController(IHttpClientFactory httpClient)

That fine, it is OK for me. But if I need to use it in ActionFilterAttribute. How can I do?

Eagle
  • 451
  • 2
  • 5
  • 14
  • https://stackoverflow.com/questions/36109052/inject-service-into-action-filter/36109690 – Noldor Jun 28 '20 at 08:40
  • Thank you your answer. It seem it resolved my problem but I think it is very complicated for me. I resolved my problem that just cast (TestController) context.Controller in ActionFilterAttribute that I can get HttpClientFactory now. Anyway I will make your answer. – Eagle Jun 28 '20 at 10:43

0 Answers0