vote up 1 vote down star

Hello,

I have a problem

My route have an extra paramater after hierarchical category.

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

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

flag

3 Answers

vote up 1 vote down

I'm pretty sure that the route handler tokenizes on the slash character so you won't be able to have a category that includes a slash -- though escaping it might work, not sure about that. You might want to format your URL as:

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

This should translate the category as "World Asia".

If that doesn't work then perhaps you need another route that matches on subcategory as well.

{year}/{category}/{subcategory}/{month}/{day}/{name}
link|flag
vote up 0 vote down

Add another rule to your routing with the name parameter.

link|flag
vote up 0 vote down

Thanks for your replies. I'll try your solutions.

link|flag

Your Answer

Get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.