Master Pages on Application Pages
Applies to: SharePoint Foundation 2010
In Microsoft SharePoint Foundation, application pages can now inherit a customized site master page through the DynamicMasterPageFile attribute.
Using the DynamicMasterPageFile Attribute
The DynamicMasterPageFile attribute replaces the MasterPageFile attribute on application pages in SharePoint Foundation. By using the DynamicMasterPageFile attribute, the application page references the site master page rather than the default application master page. If needed, site administrators can disable this automatic referencing of the site master page through Central Administration or by using the MasterPageReferenceEnabled property of the SPWebApplication object.
There are some application pages that have safeguards to prevent errors that can occur due to "broken" site master pages. These safeguards are detailed below.
Safeguarded Application Pages
These are the application pages that have safeguards against a broken master page. If these pages encounter an error when loading the dynamic master page, a safe master page in the _layouts folder is loaded instead.
AccessDenied.aspx
MngSiteAdmin.aspx
People.aspx
RecycleBin.aspx
ReGhost.aspx
ReqAcc.aspx
Settings.aspx
UserDisp.aspx
ViewLsts.aspx
Using Dynamic Master Pages on Custom Application Pages
If you are creating a custom application page, your page must inherit from the LayoutsPageBase base class and must use one of the dynamic tokens listed below.
Dynamic tokens:
~masterurl/default.master – The application page references the master page file that is stored in the MasterUrl property.
~masterurl/custom.master – The application page references the master page file that is stored in the CustomMasterUrl property.
Important
Static tokens cannot be used in the DynamicMasterPageFile attribute.