Closed brgrz closed 9 years ago
Aren't you missing the ? within your route?
What do you mean? Where?
[Route("list/{year}/{month}/{day}")]
No, it's a blog-like route/action. Works perfectly fine.
I mean here: [Route("list/{year?}/{month?}/{day?}")]
Ha! You were right, I completely missed it. There were still some issues particularly with interfering other routes, so I had to add :int
constraints also so that it looks like this
[Route("list/{year:int?}/{month:int?}/{day:int?}")]
thanks for pointing that out
After further investigation I found out that exactly the same setup results in route missing when using the Order parameter in the above route.
So this would work
[Route("list/{year:int?}/{month:int?}/{day:int?}")]
but this won't (missing route)
[Route("list/{year:int?}/{month:int?}/{day:int?}", Order = 1)]
where Order = 0 is used for another route/action on this controller.
Do you happen to know why would that be?
How does the other Route look like?
[Route("{*path}", Order = 0)]
Do you think this one picks up everything since it is *?
For AddAsNeutralAndDefaultCultureRoute Glimpse shows
{*path} (neutral)
en/{*path} (en)
list/{year}/{month}/{day} (neutral)
en/list/{year}/{month}/{day} (en)
What routes are you missing?
And I would suggest starting with the more specific one (Order 0 for list/{year:int?}/{month:int?}/{day:int?}).
Changing the order parameter to switch more specific route with less specific one did the trick.
I'd have less problems with route debugging if Glimpse wasn't crashing for me all the time.
We already discussed the optional arguments and your @Dresel solution was to do this:
For the following controller action:
I just noticed this registers only the route that picks up URLs with complete arguments:
/sl-si/objave/2014/12/23
(content per day 23. 12. 2014)but not
/sl-si/objave/2014/12
(content per month 12/2014)or
/sl-si/objave/2014
(content per year 2014).Without using RL the route registration works with all these three options of URLs.