Question

I want to create an MVC application where by I can create areas of a site that use the same functionality but work under a seperate URL. e.g.

I want to use the same image gallery controller (type not instance) under two different URLs "/Event1/Gallery" and "ProductInformation/Gallery". However if I register this in the routes table and use the html helpers to create links would use the first registration found in the routes table as the link rather than being the actual URL that the controller is serving out at the time.

My questions are:

Is this the correct approach? If not what would be the better solution. If it is the correct approach how do you stop the helpers from using the first registered controller name rather than the page it is on?

Thanks

Was it helpful?

Solution

Could you use named routes. That way you specify the route name instead of action, controller using the url helper and create the links yourself. Or you could create your own helper method to encapsulate each link.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top