0

I am new to ASP.NET MVC.

We are writing the basic architecture for a new website and are using asp.net mvc3 for the presentation layer.

On the business side it has been decided that our new site should use an url structure that reflects the data hierarchy.

Example of a fictive url: http://mycraftsite.com/profesionals/tailors/patterns/persian/mediastyle/kiefalpattern

This does not conform to the controller/action/id pattern that I see in a lot of examples. Can an url structure like ours fit the MVC concepts?

Thanks Thomas Holme

1

2 Answers 2

2

Try use the route pattern

{controller}/{action}/{*parameters}

ex. Home/Index/Param1/Param2/Param3...

@HomeController:

public ActionResult Index(object param1, object param2, object param3...) { }

the '*' indicates that route must match greedy parameters. So, now you can pass multiples parameters to your action method. Like the data hierarchy structure that you desire.

Hope it helps.

Sign up to request clarification or add additional context in comments.

Comments

0

You could define your own route handler, similar to what's done here:

MVC route with array of homogeneous parameters

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.