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 the code right now (just a simple function) ( device- my controller):
[HttpGet]
[Route("Device/{id}/IsValid")]
public bool IsValid(int id) {
return true;
}
But when I turn to the next the URL, the browser says it can not find the page: localhost/device/2/IsValid.
And when I try to use this url, it works fine: localhost/device/IsValid/2
So, can you use the localhost/device/2/IsValiddefault route instead localhost/device/IsValid/2? And how to do it?
Feel free to ask for more info! Thanks in advance!
source
share