Can I edit my router at run time?

2

I have the route of my area

  context.MapRoute(
      "Cadastro_default",
      "{Empresa}/Cadastro/{controller}/{action}/{id}",
      new { empresa = Empresa.GetEmpresa(), action = "Index", id = UrlParameter.Optional }
  );

But it does not execute the GetEmpresa () method during browsing

    
asked by anonymous 20.10.2014 / 20:58

1 answer

2

The route is not able to process a complex entity like the way you are doing it. If I understand correctly, you want to put the multi-lieutenant model on the route, and I believe that approach is incorrect.

The correct thing is for you to define the company within a Filter, more or less how do I in this answer, where I define a log .

    
20.10.2014 / 21:18