Asp.net mvc 5.1 introduced the following breaking change (http://www.asp.net/mvc/overview/releases/mvc51-release-notes):
Ambiguities in attribute routing matches will now report an error rather than choosing the first match.
I have the following:
SomeController:
[Route("{sort=data}/{page:int=1}/{type:values(completo|parcial)=completo}", Name = "Default"), OutputCache(Duration = 5)]public ActionResult Index(string sort, int page, string type)
AccountController:
[AllowAnonymous, Route("entrar")]public ActionResult Login(string returnUrl)
When i try to acess /entrar it leads to ambiguity with the Index controller.
Any ideas on how to fix this?
Thank you.
Fixed it this way:
[Route("{sort:values(mais-votados-7|comentado-por-ultimo|data)=data}/{page:int=1}/{type:values(completo|parcial)=completo}", Name = "Default")]
[OutputCache(Duration = 5)]
public ActionResult Index(string sort, int page, string type)
By setting the allowed values of {sort}, /entrar does not match this route anymore.