In the asp.net-mvc application, you can specify the so-called routing attributes in the controller: [Route]
& [RoutePrefix]
.
Help to understand for what purposes it is customary to use this functionality.
As far as I could understand with the help of these attributes it is possible to build more conveniently readable url
:
public ActionResult GetDetailUserInfo(int userId){}
in the absence of attributes url
address will look like:
Controller Name / GetDetailUserInfo? UserId = 5
if you add the route attribute to the method [Route("{userId}/Details")]
then the url
will look like this:
Controller Name / 5 / Details
Are there any other cases when you need to use these attributes?