I have some confusion over MasterPageFile attribute.There are two options available for master pages, custom master page and default master settings in SharePoint Designer. One master page I have set as custom and other with default master page. Now every new page I am creating it is taking custom master page by default and also all old(pre defined) layout pages (e.g. welcomelinks.aspx) taking custom master page.

1) even I am giving MasterPageFile attribute with ~masterurl\custom.master in any layout it is taking custom master page by default the what is the exact use of MasterPafeFile=''~masterurl\custom.master" .Without using this attribute it is taking custom master page

2) I have added MasterPafeFile=''~masterurl\default.master" in one pre defined layout (e.g. welcomelinks.aspx) but still this page is taking custom.master page.Can we set default master page for any layout with same MasterPafeFile attribute.

3)In SharePoint 2010 I can see custom master page is also applicable in _laouts/settings.aspx This was not the case in MOSS 2007.Is this a new functionality in SharePoint 2010.

2 Answers 2


Not sure what you are trying to do but in SharePoint 2010 (unlike MOSS 2007), you can have same master page applied to both site page and application pages.

~masterurl\default.master and ~masterurl\custom.master are the tokens used by the pages, the values of which are determined by SPWeb.MasterUrl and SPWeb.CustomMasterUrl proprties respectively. The idea behind using the token instead of hard coded is that the token can be replaced with actual values (by SPWeb.MasterUrl orSPWeb.CustomMasterUrl ) early in Page life cycle. This helps to change the master page using Site Settings without modifying the page itself (and leaving it ghosted/uncustomized). Other thing to remember is that SPWeb.CustomMasterUrl value is used for Publishing Pages (as opposed to other site pages) and SPWeb.MasterUrl is ignored.


custom.master and default.master just tokens. You should manipulate it using the web app properties. CustomMasterUrl can be set to your custom master pages. MasterUrl - if you set it to v4.master it will apply to System Pages. If you want your _layouts files to use/not use custom master pages, there is a property that you can set at the web level. I think its called MasterPageReferenceEnabled (default set to true). I've not tried it myself, but you can check that out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.