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?
Multiple Routes You need to provide at least two parameters in MapRoute, route name, and URL pattern. The Defaults parameter is optional. You can register multiple custom routes with different names.
In its simplest form, a Namespace Routing Language (NRL) schema consists of a mapping from namespace URIs to schema URIs. An NRL schema is written in XML. DSDL Part 4 (ISO/IEC 19757-4), NVDL is based on NRL.
The System. Web. Mvc namespace contains classes and interfaces that support the ASP.NET Model View Controller (MVC) framework for creating Web applications. This namespace includes classes that represent controllers, controller factories, action results, views, partial view, model binders, and much more.
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.
I am not sure if it is what you want.
http://haacked.com/archive/2008/11/04/areas-in-aspnetmvc.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With