1
Reply

What is ViewStart Page in ASP.Net MVC?

Ritesh Singh

Ritesh Singh

8y
1.2k
0
Reply

    Basically by default we have master layout in Views>> Shared >> _Layout.cshtml and this thing is defined in _ViewStart.cshtml that which one is our default master layout.When we create a view with master layout by default its master layout is _Layout.cshtml, but we can change it from _ViewStart.cshtml When we write:@{Layout = null;} in our view we say that this view does not have any master layout, this is used when we create partial view mostly or a standalone view without master layout.If you open _ViewStart.cshtml by default it has this written in it:@{Layout = "~/Views/Shared/_Layout.cshtml"; } and we can change it if we want to.You can also change of some specific view Master Layout by writing on top of it the url of master layout view:@{Layout = "~/Views/Shared/_CustomMasterLayout.cshtml";}