blog.mha.dk
The on-line blog of Michael Holm Andersen

Apply MasterPage to (many) pages

Tuesday, 20 January 2009 19:08 by mha

Today I found out that it's possible to apply a MasterPage both on Application Level and on Folder Level.

Application Level

<configuration>
    <system.web>
               <pages masterPageFile="~/mhaMP.master" />
   </system.web>
</configuration>

All .aspx pages will now the  use the MasterPage called "mhaMP.master" (if the .aspx file does not contain a 'Content' control, the MasterPage will not be applied to it).


Folder Level

<configuration>
    <location path="admin">
    <system.web>
               <pages masterPageFile="~/mhaMP.master" />
   </system.web>
   </location>
</configuration>

Using a web.config file in the "admin" folder, which contains the above, all .aspx pages in the "admin" folder will now the  use the MasterPage called "mhaMP.master" (again, if the .aspx file does not contain a 'Content' control, the MasterPage will not be applied to it).

Comments are closed