Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Closed Issue: MVC Attribute Routes for Actions should have higher precedence [1400]

$
0
0

Given the following controllers, I would expect a url like: /admin/Cool?id=99 to be generated when I ask for the url to 'Foo'/'Index'. However in this case the route for the controller-level attribute is considered a better match because its template has better precedence, and the result is: /admin/Person/Index/999

We should consider an additional criteria for route ordering when used for link generation - action-level routes should always come first.

```
[Route("admin/Person/{action}/{id?}")]
public class FooController : Controller
{
[Route("admin/Cool/{*params}")]
public string Index()
{
return "Index";
}

public string Delete()
{
return "Delete";
}
}

public class HomeController : Controller
{
public string Index()
{
return Url.Action("Index", "Foo", new { id = 999 });
}
}
```
Comments: Verified.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>