Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.