views:

673

answers:

2

Hello!

I have a small problem, I can't find any documentation on the namespaces parameter for MapRoute. Can anyone explain how I should use that?

I want to map ~/Controllers/Projects/ProjectController.cs to this url ~/Projects/ but I also have other controllers in ~/Controllers/Projects that I want to map to other URL's. So I need to add a namespace for those URL's. How to?

A: 

The namespaces parameter lets you specify where the infrastructure should search for additional controller types, by default mvc will search ALL classes in the executing assembly (the site project), and those that implement IController become candidates.. basically, you can put the controllers in as many nested folders as you want if they are part of the asp.net mvc project..

The main use of the namespaces parameter is if you want to store your controller classes in an external assembly, in which case you can specify the namespace to where those controllers are.

meandmycode
A: 

I am not sure if it is what you want.

http://haacked.com/archive/2008/11/04/areas-in-aspnetmvc.aspx

Canton