c# - How to remove Home from HomeController in Mvc -
i have homecontroller , has many actions in it. users visit actions without typing home. here route below
routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional } );
i users not enter controller name, home in case. how can that? or mandatory?
you can add custom route before defult route this:
routes.maproute( "onlyaction", "{action}", new { controller = "home", action = "index" } ); routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional } );
Comments
Post a Comment