c# - Route mapping doesn't fine controller action method, when using areas. Err: The resource cannot be found -


i've tried searching , read several answers, can't route mapping working. i'm sure i'm missing simple.

i want pass optional 'tab' string through url can pre-select tab on rendered page. desired url example: http://localhost/manufacture/job/view/1234/process-route-tab/

other possibly relevant info can think of is:

  • i using areas
  • this route mapped

the mapping below works fine url: http://localhost/manufacture/job/view/1234/

but including tab part in example url above gets 'the resource cannot found' error.

global.asax.cs excerpt

public static void registerroutes(routecollection routes) {     routes.ignoreroute("{resource}.axd/{*pathinfo}");     routes.maproute(         "default", // route name         "{controller}/{action}/{id}/{tab}/", // url parameters         new {             controller = "account",             action = "index",             id = urlparameter.optional,             tab = urlparameter.optional         }, // parameter defaults         new string[] { "test.webapp.controllers" }    ); } 

jobcontroller.cs excerpt

public class jobcontroller : basecontroller  {      // ...      public actionresult view(int id, string tab = "info", string notifications = "")     {         // never gets here!         notification.unserialize(notifications);         return view();     } } 

among various tinkering has made no difference, have far tried:

  • removing notifications parameter action method
  • hard coding controller name , action name in mapping i.e. job/view/{id}/{tab}
  • having separate mapping preceded default mapping, in registerroutes method

hopefully can shed light here, , stop me haemorrhaging time on such small detail.

each area has area route registration file in area folder. should change route in manufacturearearegistration.cs file in manufacture area folder.

something like,

public override void registerarea(arearegistrationcontext context) {     context.maproute(         "manufacture_default",         "manufacture/{controller}/{action}/{id}/{tab}",         new { action = "index", id = urlparameter.optional, tab = urlparameter.optional }     ); } 

regards


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -