Skip to content
txgz999 edited this page Mar 20, 2020 · 8 revisions
Attribute Routing in WebApi

The following articles explains attribute routing well

We often use the RoutePrefix attribute at the controller level with Route attribute at the method level.

There is a convention to detect the http verb a method support based on method name:

// POST: api/fcm/SendMessage
[Route("sendmessage")]
public async Task<IHttpActionResult> PostMessage(

but we can have complete custom method name with a http verb attribute as follows:

// POST: api/fcm/SendMessage
[Route("sendmessage")]
[HttpPost]
public async Task<IHttpActionResult> SendMessage(

Clone this wiki locally