I have some code that creates a new site in SharePoint. When browsing on a newly created site, a file not found error is thrown. If you browse at /_layouts/ChangeSiteMasterPage.aspx, you can select a new site master & amp; System master page, and the site works fine. This KB article has completely described my symptoms:
My problem is that two (maybe three?) Solutions have been given, only one works if I manually new master pages I choose if it works fine. The second methodology is to activate the publishing feature on the new site. It does not fix anything.
This is also a recommendation for the site definition to primary to the publishing feature that I am using for a new site. In my case, this is STS # 1 (blank site), and the feature of the publication does not reduce my problem.
Does anyone know how can I fix the correct master page?
We do this through a representative control. In Onload we call the following method:
Private Zero Configurable Page (SPWeb Web) {string masterURL = string.Empty; MasterURL = web.Site.ServerRelativeUrl + "/_catalogs/masterpage/XXX.master"; MasterURL = masterURL.Replace ("//", "/"); Web.MasterUrl = masterURL; Web.CustomMasterUrl = masterURL; Web.Update (); }
Do not forget to dispose of SPSIte and SPWeb objects and you must set AllowUnsafeUpdates to the right.
Hope this helps
Comments
Post a Comment