gulbaek
gulbaek

Reputation: 2551

Asp.net mvc dynamic route for Categories tree

Hi Is it possible to create a route, who accepts X number of Categories/subCategories

mysite.com/CategoryName//ProductID/ProductName
mysite.com/CategoryName/Sub1CategoryName/ProductID/ProductName
mysite.com/CategoryName/Sub1CategoryName/Sub2Category/ProductID/ProductName

Of cource I could create a route for each possible combination, but I really don't know how deep my categories tree would be.

Maybe something with a regular expression.

Upvotes: 2

Views: 1180

Answers (1)

eglasius
eglasius

Reputation: 36035

Define your own route handler, similar to what I posted in this answer:

MVC route with array of homogeneous parameters

Upvotes: 2

Related Questions