Url Route asp.net -
my model is
public class organization { public int id { get; set; } public string url { get; set; } }
and routeconfig
routes.maproute( "url", "{controller}/{action}/{url}", new { controller = "organization", action = "pagecontent", url = "" } ); routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional } );
is there way fix routing both url , id work? example ...organization/details/{id} , ...organization/details/{url} both work
as both routes seems same can combine both , define 1 , in action (or onactionexecuting) can decide behavior based id or url
routes.maproute( name: "default", url: "{controller}/{action}/{segment}", defaults: new { controller = "home", action = "index", segment = urlparameter.optional } );
or can map route id , take url querystring.
Comments
Post a Comment