6

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?

1

2 Answers 2

8

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.

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

1 Comment

I'm looking for an example to get the syntax.
1

I am not sure if it is what you want.

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

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.