_PageStart.cshtml vs _AppStart.cshtml in ASP.NET WebPages

What is the difference between _PageStart.cshtml vs _AppStart.cshtml? Can I use them interchangeably?

+7
source share
1 answer

_AppStart.cshtml is executed once when the application starts. This is the place to set global variables or configure email, etc. _PageStart.cshtml is executed every time a page is requested in the same folder with a lower level. This is the place to perform on-demand processing, such as setting layout pages or denying access to a folder for unauthenticated users.

See this article on Microsoft web pages .

Because they run at different times in the application’s life cycle, it’s hard to understand how they can be used interchangeably, whatever you mean by that.

+21
source

All Articles