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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.