Routing

Routing, simply put, is the process of receiving a request and mapping it to a controller action. If you are familiar with MVC routing, you will find that Web API routing is similar to it but with some differences; Web API uses the HTTP request type instead of the action name in the URL (as in the case of MVC) to select the action to be executed in the controller.

Routing configuration for Web API is defined in the file App_Start\WebApiConfig.cs. The default routing configuration of ASP.NET Web API is as shown in the following:

namespace MovieTickets.WebAPI
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            config.Routes.MapHttpRoute(
                 name: "DefaultApi",
 routeTemplate: "api/{controller}/{id}", ...

Get Building Mobile Applications Using Kendo UI Mobile and ASP.NET Web API 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.