controller route asp net code example
Example: route( controller ) c#
By using the new [controller] token in your attribute routes you can ensure
that the controller name in the route, is kept in sync with the name of the
controller class. In the example below, [controller] will always be expanded
to the name of the controller regardless of any future refactorings – in this
case it will be Hello.
[Route("[controller]")]
as [area], [controller], [action], etc.
[HttpGet("")]
[Route("")]
[HttpGet("/otherprefix/name")]
[HttpGet("name/{id}")]
public IActionResult Index(int id){ ...
[HttpGet("{id:int:required}")]