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've received a WSP where the contained pages reference the master page as shown in the title. The pages are deployed to a folder under the Site (ie http://app.contoso.com/PagesFolder/welcome.aspx). It throws a FileNotFound error saying /PagesFolder/site/_catalogs/masterpage/m.master does not exist.

Where is the problem? Is that as expected or is there something I need to configure to make the token work?

share|improve this question
    
With which property do the page reference the master page? –  James Love Jan 4 '13 at 21:09
add comment

1 Answer

Check the MasterPageFile property is being set correctly and you could set any master page from gallery e.g. MasterPageFile="~site/_catalogs/masterpage/v4.master".

example usage in a Page layout:

<%@ Page Language="C#" Inherits="Microsoft.SharePoint.WebPartPages.WikiEditPage" MasterPageFile="~site/_catalogs/masterpage/v4.master" meta:webpartpageexpansion="full" meta:progid=”SharePoint.WebPartPage.Document" %>

Update:

There are different ways you can refer the master page in your page layouts:

  • This is a relative or absolute path to a master page. Relative locations are based on the page instance's location - i.e. "../_catalogs/masterpage/custom.master" will find custom.master in the current SPWeb's master page gallery, which may or may not be the top-level site's master page gallery.
  • Site-Relative Master Page ~site/_catalogs/masterpage/custom.master.
  • Site Collection-Relative Master Page ~sitecollection/_catalogs/masterpage/custom.master.
share|improve this answer
    
Here's the Page Directive: <%@ Page Language="C#" MasterPageFile="~site/_catalogs/masterpage/CustomDefault.aspx" Inherits="MyApp.Welcome" Title="Welcome" %> –  Sam Larko Jan 7 '13 at 15:28
    
Your pages are created under a sub-folder "PagesFolder" and the MasterPageFile directive looks for the master page in the following path: "/PagesFolder/site/_catalogs/masterpage/CustomDefault.master" which definitely is not a valid path. Could you please also make sure that CustomDefault.master is present in the master pages gallery? –  Falak Mahmood Jan 7 '13 at 22:36
    
I have updated my post with different techniques to refer master page. –  Falak Mahmood Jan 7 '13 at 22:44
    
Thanks for the answer, which helped me in one of my scenario, of an Office-365 Site. Using the below URL I could refer the root-site master-page: ~sitecollection/_catalogs/masterpage/<master-page>.master –  Abhijith Shastry Mar 18 at 10:43
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.