I am trying to get the following links:
- / (maps to
AccountController/Index) - /account/login (maps to
AccountController/Login) - /2112/emails (maps to
EmailsController/Indexaction and 2112 would be a route parameter) - /2112/emails/list (maps to
EmailsController/Listaction and 212 would be a route parameter)
I am not being able to get the routes working as they seem to be conflicting with each other. The following makes me have the route param at all times which is not what I need. It will not bind without providing the database param.
routes.MapRoute(
name: "Default",
url: "{database}/{controller}/{action}",
defaults: new { database = UrlParameter.Optional, controller = "Account", action = "Index" }
);
routes.MapRoute( name: "Default_with_hidden_index", url: "{controller}", defaults: new { action = "Index" }, constraints: new { action = "Index" } ); routes.MapRoute( name: "Default", url: "{controller}/{action}", defaults: new { controller = "Account", action = "Login" } );This will solve the first and second topics I asked but not the other two.