Can I edit my router at runtime?

Asked

Viewed 53 times

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 navigation

  • You are using the route mechanism wrong. I will reply.

  • I saw in an article, the guy used something similar, but not with areas :/

1 answer

2


The route is not capable of processing a complex entity like the way you’re doing it. If I understand correctly, you want to put the multi-lieutenant model on course, and I believe this approach is incorrect.

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

  • Gypsy, in fact, just pass the name of the company that is active in the URL

  • 1

    @Tiagosilva First I remember if I have answered or not. Then I do a search ;)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.