Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

WebApi: Order execution of ExceptionFilter and ActionFilter

$
0
0

Hi!

I am using ASP.NET WebApi. 
There is global ActionFilter that is used for logging special information about each request. 
There is global ExceptionFilter that is used for logging information about exceptions. 
This filter logs information about exception and prepares Respose with some special text and http status.

If some exception occurs the execution order of these filters is the following:

1. OnActionExecuted method of the ActionFilter
2. OnException method of the ExceptionFilter

My problem is that at the moment when OnActionExecuted is being executed 
I need to know http status and content type of the response. 
But I cannot grab this information because ExceptionFilter hasn't been invoked yet.

What can you advise? Maybe something wrong with the architecture?
Implementing IFilterProvider I probably can order execution of filters but it seems to work only for filters of the same kind (for example Action filters)
not for the mixture (Authorization/Action/Exception)?


Viewing all articles
Browse latest Browse all 4850

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>