Is it possible to transfer data from the DelegatingHandler to the controller in the ASP.NET web API?

I implement authorization-related delegation when I load the api (caller) user profile from the database. When the authorization is successful, I would like to transfer this instance to the controller, otherwise I have to download it again.

Is there a way to do this without using a session or rely on cache storage?

+4
source share
1 answer

The HttpRequestMessage class contains a Properties dictionary that you can use to store this information. However, I am not sure if it remains between the handler call and the controller action. Otherwise, you can try using an action filter in which an action context has already been created. An action context gives you access to action arguments, where you can add an additional argument to pass to the action.

+13
source

Source: https://habr.com/ru/post/1479523/


All Articles