CHAPTER 24

image

Filters Part II

In this chapter, I continue describing the Web API support for filters and demonstrate how authorization filters work. I also show you two kinds of special filters: exception filters and override filters. Table 24-1 summarizes this chapter.

Table 24-1. Chapter Summary

Problem

Solution

Listing

Create an authorization filter.

Implement the IAuthorizationFilter interface, derive from the AuthorizationFilterAttribute class, or use the Authorize attribute.

1, 5–9

Restrict access to an action method.

Apply an authorization attribute to the action method or its containing controller.

2–4

Handle an exception thrown by an action method ...

Get Expert ASP.NET Web API 2 for MVC Developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.