CHAPTER 21

image

URL Routing: Part II

In this chapter, I continue describing the Web API URL routing feature, focusing on direct routes, which are defined by applying attributes to controllers and action methods. I also show you different ways in which you can customize the routing process. Table 21-1 summarizes this chapter.

Table 21-1. Chapter Summary

Problem

Solution

Listing

Define a direct route.

Apply the Route attribute to one or more action methods or to the controller itself.

1, 2, 10, 11

Define a common prefix that will be used in all of the direct routes in a controller.

Apply the RoutePrefix attribute to the controller class.

3

Define an optional ...

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.