I'm implementing an authorization related DelegatingHandler where I load-up the api user (caller) profile from database. When the authorization is successful I'd like to pass this instance to the controller otherwise I'd must load it again.
Is there any way to do this without using session or rely on repository cache?
The HttpRequestMessage class contains a dictionary "Properties" that you could use to store that information. However, I am not sure if it is get persisted between the handler invocation and the controller action. Otherwise, you can try with an action filter where the action context is already created. The action context gives you access to the action arguments, where you can add an additional argument to be passed to the action.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With