asp.net mvc - routing issue in mvc4 -
i have issue in routing in mvc 4
my url goes
http://localhost:portnumber/session/view?id=918&pid=186
i want url this
http://localhost:portnumber/session/view/918/186
i have view
@html.routelink("more..", "default", new {controller="session",action="view",id=e.id,pid=e.pid }) routes.maproute( name: "sessionview", url: "{controller}/{action}/{id}/{pid}", defaults: new { controller = "session", action = "view", id = urlparameter.optional, pid = urlparameter.optional } );
the problem you're not referring correct route.
in routing table, you've added route name "sessionview", in @html.routelink, refer route called "default".
the correct call should be:
@html.routelink("more..", "sessionview", new {controller="session",action="view",id=e.id,pid=e.pid })
Comments
Post a Comment