views:

130

answers:

2

How can I make routing for this?

URL: /category/main/sub/ or /category/main/sub1/subsub/

I want to have /main/sub/ and /main/sub1/subsub/ as parameters in Index action method of CategoryController.

+2  A: 

Found the answer:

Should use "/category/{*path}" instead of "/category/{path}" in the routing path.

alexey
A: 

Hello,

I have a same problem but my route have an extra paramater after category.

/2009/World/Asia/08/12/bla-bla-bla

and asp.net mvc does not support this because my routing should be

{year}/{*category}/{month}/{day}/{name}

i tried use constraint like

year = @"(\d{4})",category = @"((.+)/)+", month = @"(\d{2})", day = @"(\d{2})"

but i cannot find any solution.

Is there any comment?

Thank you

Huseyin
Try opening your own question...
Adrian Grigore
As Adrian said, you should open your own question rather than ask a question in the answers to a existing question. But the gist of the answer is: The catch-all parameter must be the last parameter in the list, you can't have it in the middle: http://msdn.microsoft.com/en-us/library/cc668201.aspx
Zhaph - Ben Duguid