3

I need to call the _ViewStart layout page for every page exept one.

How do I skip it for just one page (let's call it a.cshtml)?

Revious
  • 7,816
  • 31
  • 98
  • 147

2 Answers2

7

You can just add this to the top of the page you don't want to use the layout for.

@{
    Layout = "";
}
Tom Webster
  • 350
  • 1
  • 9
6

Source SO

As per this post by marcind

If you return PartialView() from your controllers (instead of return View()), then _viewstart.cshtml will not be executed.

Community
  • 1
  • 1
Nilesh Gajare
  • 6,302
  • 3
  • 42
  • 73