Pregunta de enrutamiento MVC 2
Frecuentes
Visto 54 equipos
0
I'm trying to create a route that looks like this
site.com/controller/{Param1}/{dbID}-{friendly-name}
and omit the default action index , and for the action edit to be at the end of the url like so
site.com/controller/{Param1}/{dbID}-{friendly-name}/edit
routes are a bit confusing for me , so any help is appreciated , Thanks!
1 Respuestas
1
Podrías intentar así:
routes.MapRoute(
"SomeRoute",
"{controller}/{param1}/{dbID}-{friendlyName}/{action}",
new
{
controller = "home",
action = "index",
param1 = "CANNOT BE OPTIONAL",
dbID = "SOME DEFAULT ID",
friendlyName = "SOME DEFAULT FRIENDLY NAME"
}
);
Respondido 13 Jul 10, 12:07
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas asp.net-mvc-2 asp.net-mvc-routing or haz tu propia pregunta.
hm , if i request the page without the index action at the end , it doesn't load :( - Nikolá Sivkov
its also important to put the default route at the bottom and the more specific routes at the top :) - Nikolá Sivkov