Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net mvc 4 - Who calls _ViewStart.cshtml and what is the sequence of steps

I am new to MVC so please bear with me. I am trying to find out who calls Viewstart.cshtml and what is the sequence of steps involved there? is it called after the route table is accessed or before it?

like image 858
Hari Subramaniam Avatar asked Feb 25 '13 12:02

Hari Subramaniam


2 Answers

The RazorViewEngine has an internal readonly field "ViewStartFileName" which specifies the name of the start view. _ViewStart.cshtml (or .vbhtml) is called each time a RazorView instance is rendered (specifically when the RenderView() method is being executed). So the "who" would be the RazorViewEngine with its corresponding RazorView class (including their base classes). To get a quite good overview on the MVC request pipeline I recommend this pdf.

like image 107
Andreas Avatar answered Oct 21 '22 21:10

Andreas


Check the image below... (What is the 'page lifecycle' of an ASP.NET MVC page, compared to ASP.NET WebForms?)

enter image description here

like image 28
LiamB Avatar answered Oct 21 '22 20:10

LiamB