Hi,
i'm new to ASP.NET MVC and i'm facing some structural design problems.
I can't figure out how to setup routing.
I want the following:
http://website/ > HomeController Action=Index Public: http://website/{controller} > SectionController Action=Index http://website/products/id > ProductsController Action=Details http://website/products/category/id > ProductsController Action=ListByCatId http://website/products/categories/ > ProductsController Action=ListCategories http://website/products/categories/id > ProductsController Action=DetailsCategories Admin: http://website/admin/ > AdminController Action=Index http://website/admin/{controller} > SectionController Action=Index
The default mapRoute is fine for most of the parts:
routes.MapRoute("Default", "{controller}/{action}/{id}", _
New With {.controller = "Home", .action = "Index", .id = ""})
When I start putting 'category' instead of the id of the product the problems start...
Should I 'hardcode' the routeUrls, e.g. "products/category/{id}"?
For the Admin part:
I'd like to put all controllers belonging to the Admin section of the website in: /Controllers/Admin/XxxController.vb. Is it possible to Namespace them and let them have the same name as in the public section? e.q.
- Website.ProductsController class for public parts and
- Website.Admin.ProductsController for the Admin section? How should I setup this?