Hi I am working with Web Api 2, is their any way I can handle request and response before reaching to the API controller.
-
You can add filter to the IIS, which can process the requests and responses as you like. iis.net/configreference/system.webserver/security/… I dont know if that is such kind of filtering you need?Casper Skoubo– Casper Skoubo2014-02-24 09:46:50 +00:00Commented Feb 24, 2014 at 9:46
Add a comment
|
1 Answer
You may be looking for a DelegatingHandler. These are HTTP Message Handlers that can process the request before it reaches the Controller and can also process the response on the way out of the pipeline. Delegating Handlers can also return the response themselves without calling the rest of the pipeline. You can read about Delegating Handlers here.
2 Comments
Utsav
Yes thanks I was looking for this solution to filter request and response.
Stephan Bauer
Another article about a DelegatingHandler can be found here: weblogs.asp.net/fredriknormen/…