c# - How can I create a route like: /{project}/{module_name}/{sub-section}/{id} -


i need create route looks this:

 /{project}/{module_type}/{module_name}/{sub-section}/{id} 

so in terms of controller/action/id mapping be:

controller = module_type action = sub-section id = id 

and there 2 other variables:

project , module_name need.

what route like:

i using latest version of mvc (mvc3)

i don't know intentions are, try this:

routes.maproute(     "newone", // route name     "{project}/{controller}/{module_name}/{action}/{id}", // url parameters     new     {         controller = "default",         action = "index",         id = urlparameter.optional,         project = urlparameter.optional,         module_name = urlparameter.optional     } // parameter defaults ); 

then typing like:

http://localhost:12345/projekt3/home/modulename/index/2 

will homecontroller , index action.

edit:
have added new action homecontroller:

public string echo(string project, string module_name, int id) {     return project + " " + module_name + " " + id; } 

and requested url:

http://localhost:25608/projekt3/home/modulename/echo/2 

the result empty page text:

projekt3 modulename 2 

Comments