Reputation: 67203
I'm trying to understand Razor Page areas. Googling around, it appears that areas are just a way to create a directory structure within a Web application. (One that seems very ugly since it is done in a separate folder from the Pages folder.)
But I can easily create folders and subfolders under the Pages folder, and that keeps everything together and simple.
So why would using areas be better than regular folders?
Upvotes: 6
Views: 2694
Reputation: 30045
Areas were added to Razor Pages as a result of some requests for the feature, seemingly by people who wanted to be able to use Razor Pages in an existing .NET Core MVC application where areas were being used, or possibly by people who wanted to be able to port existing MVC applications over to Razor Pages more easily. The ASP.NET team also saw Areas as a good fit for Razor Class Libraries.
Beyond those use cases, there seems to be little to no practical or technical benefit from using Areas in a pure Razor Pages application.
Upvotes: 7