In my MVC project has 2 Areas which is Admin and Client and I need to dynamic config Layout for Client side, In _ViewStart (in client) file will set layout for all of client pag
Remember that anything within the @{ ... }
is treated as code. So, it should be a simple matter of placing a condition in there to change how it's inherited:
@{
Layout = "~/Views/Shared/_Layout.cshtml";
if (User.Current.IsAuthenticated) {
Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
}
Though you're probaby better off looking at Themes (and have an admin/user theme). Alternatively, you can make your _Layout.cshtml
smarter and have it handle the different views based on conditions as well.
See Also: MVC3 Razor - Is there a way to change the Layout depending on browser request?