asp.net mvc - C# ASP .Net MVC 4 variable length route mapping -
i need variable length route mapping in asp.net mvc 3. understanding can map routes this:
routes.maproute( "default", // route name "{controller}/{action}/{id}", // url parameters new { controller = "home", action = "index", id = urlparameter.optional } );
but how add variable amount of parameters. routes in application have directory structure starting base address this: www.mywebsite.com/root/
anything followed root has directory structure this:
www.mywebsite.com/root/directory1/directory2/image.jpg
that correspond mapping this:
routes.maproute( "default", // route name "root/{path}", // url parameters new { controller = "directorybrowser", action = "browse" } );
but don't know how set path parameter.
you can use wildcard parameter: "root/{*path}"
Comments
Post a Comment