0

I have different controllers

ContentsController

NewsController

etc.

In ContentsController I have method

[Route("~/{seoTitle}", Order = 10)]
public async Task<ActionResult> Show(string seoTitle)

NewsController

[Route("~/News", Order = 2)]
[Route("~/News/Page/{page}", Order = 1)]
public async Task<ActionResult> Index(int page = 1)

When I try go to page /News I get error

Multiple controller types were found that match the URL. This can happen if attribute routes on multiple controllers match the requested URL.

The request has found the following matching controller types:

I understand why this happened. But how I can fix this, if I using route attributes?

adiga
  • 34,372
  • 9
  • 61
  • 83
Hryhorii
  • 1,083
  • 3
  • 17
  • 38
  • Do these controllers have route prefixes? the tilde (~) is normally used to override route prefixes. If one is not used then there is no need to use the tilde. – Nkosi Oct 12 '16 at 23:13
  • Check this http://stackoverflow.com/questions/21809556/mvc5-attribute-routing-precedence-among-controllers – Nkosi Oct 12 '16 at 23:16
  • No they haven't route prefixes – Hryhorii Oct 13 '16 at 00:49

0 Answers0