To simplify our SharePoint environment I am wanting to have a central and single location where all of the master pages are stored so I was hoping to reference the masterpage files directly from the _layouts directory.
I add the files to the "\LAYOUTS\MyMasterPages" directory and then update the SPWeb object to use that path:
web.MasterUrl = "/_layouts/MyMasterPages/newdefault.master"
But when I go to the site I get:
The referenced file '/_layouts/MyMasterPages/newdefault.master' is not allowed on this page. at System.Web.UI.TemplateParser.ProcessError(String message) at System.Web.UI.BaseTemplateParser.GetReferencedType(VirtualPath virtualPath, Boolean allowNoCompile)
at System.Web.UI.PageParser.ProcessMainDirectiveAttribute(String deviceName, String name, String value, IDictionary parseData) at System.Web.UI.TemplateParser.ProcessMainDirective(IDictionary mainDirective)
I am assuming that this may be due to trust level security policies and a CAS configuration but I am not entirely sure. Is there a way to allow this central way of using master pages across the enterprise or am I stuck using the /_catalog/ virtual path?