asp.net mvc - I need to take the controller action's name out of the URL, but don't know how -
this question has answer here:
example: view contract id of 12483, use url:
/contract/12483
i can't in asp.net mvc because asp.net route exepects /{controller}/{action}/{id} able route needed code handle request have this:
/contract/view/12483
this not restful, however.
anyone know way around this?
one option can use name of actionresult
index
instead of view
.
or can use in app_start/routeconfig.cs
routes.maproute( name: "book", url: "{controller}/{id}", defaults: new { controller = "contract", action = "view", id = urlparameter.optional });
Comments
Post a Comment