To simplify our SharePoint environment, I want to have a central and only place where all the main pages are stored, so I was hoping to link to the main page files directly from the _layouts directory.
I add the files to the "\ LAYOUTS \ MyMasterPages" directory and then update the SPWeb object to use this path:
web.MasterUrl = "/_layouts/MyMasterPages/newdefault.master"
But when I go to the site, I get:
The linked file '/_layouts/MyMasterPages/newdefault.master' on this page is not allowed. in System.Web.UI.TemplateParser.ProcessError (String message) in System.Web.UI.BaseTemplateParser.GetReferencedType (VirtualPath virtualPath, Boolean allowNoCompile)
in System.Web.UI.PageParser.ProcessMainDirectiveAttribute String valueName , IDictionary parseData) in System.Web.UI.TemplateParser.ProcessMainDirective (IDictionary mainDirective)
I assume this may be due to trust-level security policies and CAS configuration, but I'm not quite sure. Is there a way to allow this central way of using master pages throughout the enterprise, or am I sticking with / _catalog / virtual path?