How do I specify different Layouts in the ASP.NET MVC 3 razor ViewStart file?

I would like to have 2 separate Layouts in my application. Let’s say one is for the Public section of the website and the other is for the Member side.

For simplicity, let’s say all the logic for each of these sites is wrapped neatly into 2 distinct controllers.

  • PublicController
  • StaffController

And that they each have a corresponding Layout for all the View under each.

  • _PublicLayout.cshtml
  • _StaffLayout.cshtml

How do I use the _ViewStart.cshtml file to specify that all Views / Actions under “Public” use the PublicLayout and everything under “Staff” uses the StaffLayout?

3 Answers
3

Leave a Comment