c# - How to hide controller name in URL when using multiple controllers in MVC? -
i have question regarding routing in asp.net, mvc. if use 2 or more controllers, how can go routing hide both controllernames in url? i've managed hide first controllername, gets tricky when want hide second one.
i figured might not possible since webserver needs know controller for, therefor require different routes in url, should possible api find appropriate controller having action-name data availible?
routeconfig.cs:
routes.maproute( name: "proj", url: "p/{action}", defaults: new { controller = "project" } ); routes.maproute( name: "default", url: "{action}", defaults: new { controller = "access", action = "login" } );
the urls follows depending on controller i'm in:
http://localhost:56590/create <- accesscontroller http://localhost:56590/p/overview <- projectcontroller
this how want when browse site:
http://localhost:56590/create <- accesscontroller http://localhost:56590/overview <- projectcontroller
how can achieve using routing, if possible?
thanks alot explanation :)
Comments
Post a Comment