The question is as simple as the title.
Is it possible to have a route that looks like this: {controller}/{id}/{action}
?
This is what I have in code right now (just a simple function) (device
is my controller):
[HttpGet]
[Route("Device/{id}/IsValid")]
public bool IsValid(int id) {
return true;
}
But when I go to the following URL the browser says it can't find the page: localhost/device/2/IsValid
.
And when I try this URL, it works just fine: localhost/device/IsValid/2
So, is it possible to use localhost/device/2/IsValid
instead of the default route localhost/device/IsValid/2
? And how to do this?
Feel free to ask more information! Thanks in advance!
th
? And where do I have to add it?