Force all Areas to use same Layout

后端 未结 3 1233
野性不改
野性不改 2021-01-30 12:38

I have the following project structure:

  • /Views/Shared/_Layout;

  • /Areas/Area1/Views/ControllerName/Index;

...

  • /Ar
3条回答
  •  星月不相逢
    2021-01-30 12:53

    You specify a layout using:

    @{ Layout = "_Layout"; }

    If you want to make this easier to change all at once. Perhaps you could just set it as a view bag variable and pass it in on the controller. To make it even easier you could create a base controller that the other controllers inherit from and have it assign the layout to the view bag there.

    Not sure why routing would need to change or perhaps I am not understanding. Hope this helps :)

提交回复
热议问题