1.

What are Web API filters?

Answer»

Filters are BASICALLY used to add extra logic at different LEVELS of Web API framework request processing.  Different types of Web API filters are available as given below:

  • Authentication Filter: It handles authentication and authenticates HTTP requests. It also helps to authenticate user detail. It checks the IDENTITY of the user.
  • Authorization Filter: It handles authorization. It runs before controller action. This filter is used to check whether or not a user is authenticated. If the user is not authenticated, then it returns an HTTP status code 401 without invoking the action.
  • AuthorizeAttribute is a built-in authorization filter provided by Web API.
  • Action Filter: It is attributing that one can apply to controller action or entire controller. It is used to add extra logic before or after controller action executes. It is simply a way to add extra functionality to Web API services.
  • Exception Filter: It is used to handle exceptions that are unhandled in Web API. It is used whenever controller actions throw an unhandled exception that is not HttpResponseException. It will implement an “IExceptionFilter” interface.
  • Override Filter: It is used to exclude SPECIFIC action methods or CONTROLLERS from the global filter or controller level filter. It is simply used to modify the behavior of other filters for individual action methods. 


Discussion

No Comment Found