Everyone who's used ASP.NET master pages knows that you can specify which master page a
content page should use via the content page's Page directive. Most people also know
that you can also set it either programatically via code or via the Web.config file.
But did you know you can also set it by folder?
This can come in quite handy when your site is organized by content type. For example,
if you keep all your apple-related products in the /apples folder and all your orange-related
products in the /oranges folder, you might want to create a style for each that complements
the folder's content.
Continuing the above example, take a look at this short sample Web.config file.
The first section specifies that the pages in this Web should use the fruit.master
file. After that, we create two location elements, one for the /apples folder and another
for the /oranges folder. Under each of those, we specify which master page
file should be used by Web forms in those folders. The net result of these settings is that
pages in the /apples folder will use apple.master,
pages in the /oranges folder will use orange.master,
and all other pages in the Web will use fruit.master.
You can override these settings by specifying a master page at the page level, but otherwise,
ASP.NET will follow the settings in the Web.config file to determine which master page to use
for every Web form that includes an <asp:Content> control.