Downloaded 20 times

![Routing With Attributes
Route Description
[Route("patients/{id}/medications")] Easier to get to "nested" resources
[Route["patients/{id:int:min(1)}"] Constraints
[Route("patients/{id:int}")]
[Route["patients/{name:alpha}"]
Multiple routes per action
[Route("patients/{id?}")] Can apply to entire controller
[RoutePrefix("api/patients")] Prefix for all other routes in
controller
[RouteArea("Admin")] Attributes for MVC Areas](https://image.slidesharecdn.com/5-140525045747-phpapp01/75/5-web-api-2-aspdotnet-mvc5-slides-2-2048.jpg)




This document discusses routing with attributes in ASP.NET MVC 5 and WebAPI 2. It covers using route attributes to define routes for controller actions, including adding constraints and prefixes. It also mentions returning IHttpActionResult from WebAPI controllers and using CORS (Cross-Origin Resource Sharing) to enable cross-domain requests by specifying allowed origins in the Access-Control-Allow-Origin header. The document provides an overview of routing and response concepts in ASP.NET MVC 5 and WebAPI 2.

![Routing With Attributes
Route Description
[Route("patients/{id}/medications")] Easier to get to "nested" resources
[Route["patients/{id:int:min(1)}"] Constraints
[Route("patients/{id:int}")]
[Route["patients/{name:alpha}"]
Multiple routes per action
[Route("patients/{id?}")] Can apply to entire controller
[RoutePrefix("api/patients")] Prefix for all other routes in
controller
[RouteArea("Admin")] Attributes for MVC Areas](https://image.slidesharecdn.com/5-140525045747-phpapp01/75/5-web-api-2-aspdotnet-mvc5-slides-2-2048.jpg)


